Ant*_*nAL 2 authentication smtp ruby-on-rails actionmailer
我正在尝试向用户发送确认电子邮件.
但我得到以下错误:
Net :: SMTPAuthenticationError(502 5.5.2错误:命令无法识别
production.rb中的配置如下:
# Disable delivery errors, bad email addresses will be ignored
config.action_mailer.raise_delivery_errors = true
# set delivery method to :smtp, :sendmail or :test
config.action_mailer.delivery_method = :smtp
# these options are only needed if you choose smtp delivery
config.action_mailer.smtp_settings = {
:address => 'path_to_address_specified_by_my_hoster',
:port => 25,
:domain => 'my_domain.com',
:authentication => :plain,
:user_name => 'signup@my_domain.com',
:password => 'password'
}
Run Code Online (Sandbox Code Playgroud)
我在我的托管服务提供商的用户配置文件中创建了一个邮箱,名为"signup@my_domain.com"
对于创建的邮箱,他们向我发出了登录名和密码:
login = verbose_login
password = verbose_password
我还没完全理解:user_name的确切格式.
我应该用吗?
:user_name => "signup@my_domain.com"
Run Code Online (Sandbox Code Playgroud)
要么:
:user_name => "signup"
Run Code Online (Sandbox Code Playgroud)
要么:
:user_name => "verbose_login"
Run Code Online (Sandbox Code Playgroud)
或者此字段特定于邮件服务器,我必须要求托管服务提供商的支持?
又有什么区别:authentication =>:plain和:login?
谢谢.
这适合我:
config.action_mailer.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'gmail.com',
:user_name => 'my_nick@gmail.com',
:password => 'secret_password',
:authentication => 'login',
:enable_starttls_auto => true
}
Run Code Online (Sandbox Code Playgroud)
更多信息在这里
切赫
| 归档时间: |
|
| 查看次数: |
6752 次 |
| 最近记录: |