Mic*_*ant 3 ruby email smtp ruby-on-rails actionmailer
尝试从Ruby on Rails发送电子邮件,但得到这个:
SocketError in UsersController#create
getaddrinfo: nodename nor servname provided, or not known
Run Code Online (Sandbox Code Playgroud)
我的environment/development.rb文件有:
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: "my_company.org",
authentication: "plain",
enable_starttls_auto: true,
user_name: "my_username@my_company.org",
password: "my_pass"
}
Run Code Online (Sandbox Code Playgroud)
和
config.action_mailer.delivery_method = :smtp
Run Code Online (Sandbox Code Playgroud)
和
config.action_mailer.default_url_options = { :host => 'localhost:5000' }
# 5000 rather than 3000 as I am using foreman.
Run Code Online (Sandbox Code Playgroud)
我使用我的Gmail做了同样的事情,以下是我的配置,尝试查看它是否有效
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:authentication => :plain,
:user_name => "<my gmail>@gmail.com",
:password => "<my gmail password>",
:openssl_verify_mode => 'none'
}
Run Code Online (Sandbox Code Playgroud)
请注意
:openssl_verify_mode => 'none'
Run Code Online (Sandbox Code Playgroud)
部分跳过SSL错误.
但抱歉,我不知道错误是什么,可能您尝试将Gmail SMTP服务器与其他域名一起使用.
| 归档时间: |
|
| 查看次数: |
9078 次 |
| 最近记录: |