【发布时间】:2019-07-19 12:33:27
【问题描述】:
我收到这个错误
getaddrinfo: Servname not supported for ai_socktype
在用户注册后发送确认电子邮件时在 heroku 中。
我使用弹性电子邮件作为 smtp,但在 heroku 中找不到任何插件。我需要一个插件来发送电子邮件吗?
【问题讨论】:
标签: ruby-on-rails email heroku devise
我收到这个错误
getaddrinfo: Servname not supported for ai_socktype
在用户注册后发送确认电子邮件时在 heroku 中。
我使用弹性电子邮件作为 smtp,但在 heroku 中找不到任何插件。我需要一个插件来发送电子邮件吗?
【问题讨论】:
标签: ruby-on-rails email heroku devise
错误是由于将 smtp_port 解析为字符串。将 smtp_port 类型转换为整数将解决此问题。令人惊讶的是,我只能在 heroku 中复制错误。
# smtp mail setup
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { host: 'abc.herokuapp.com' }
config.action_mailer.smtp_settings = {
address: ENV['SMTP_ADDRESS'],
port: ENV['SMTP_PORT'].to_i,
domain: ENV['SMTP_DOMAIN'],
user_name: ENV['SMTP_USER_NAME'],
password: ENV['SMTP_PASSWORD'],
authentication: 'plain',
enable_starttls_auto: true
}
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_options = { from: 'contact@abc.com' }
【讨论】: