我得到了这个错误
getaddrinfo: Servname not supported for ai_socktype在heroku中,在用户注册后发送确认电子邮件。
我使用弹性电子邮件作为smtp,我在heroku中找不到任何插件。我需要一个插件来发送电子邮件吗?
发布于 2019-02-27 16:43:39
错误是由于将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' }https://stackoverflow.com/questions/54877490
复制相似问题