首页 > 解决方案 > SocketError (getaddrinfo: nodename or servname provided, or not known): Rails Mailer

问题描述

我的动作邮件配置是:

config.action_mailer.perform_caching = false
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
 address: 'smtp.mycustumdomail.com',
 port: 587,
 domain: 'mycustomdomain.com',
 user_name: 'memories@mycustomdomain.com',
 password: 'mypassword',
 authentication: 'plain',
 enable_starttls_auto: true 
}

对于上述配置,我收到以下错误:

[ActiveJob] [ActionMailer::DeliveryJob] [14a369d5-5a2c-44fd-bb4b-2c5a5edf90a6] 在 78.46 毫秒中从异步(邮件程序)执行 ActionMailer::DeliveryJob(作业 ID:14a369d5-5a2c-44fd-bb4b-2c5a5edf90a6)时出错:SocketError (getaddrinfo:提供节点名或服务名,或未知):

我从 Godaddy 购买了域名。并将其邮件配置为gmail gsuite。

标签: ruby-on-railsactionmailer

解决方案


我有同样的问题,并通过更改 smtp 设置解决了它。

谢谢zakariah1!

config.action_mailer.smtp_settings = {
 address: 'smtp.gmail.com',
 ...
}

推荐阅读