网:: SMTPAuthenticationError 502 5.5.2 Rails中的ActionMailer [英] Net::SMTPAuthenticationError 502 5.5.2 in Rails ActionMailer
问题描述
我试图发送确认邮件给用户。
i'm trying to send confirmation email to the user.
但我收到以下错误:
的Net :: SMTPAuthenticationError(502 5.5.2错误:无法识别的命令
Net::SMTPAuthenticationError (502 5.5.2 Error: command not recognized
在production.rb组态以下内容:
Configuration in production.rb is following:
# 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'
}
我在我的托管服务提供商,创建命名为用户配置文件的邮箱signup@my_domain.com
I have created a mailbox in user profile at my hosting provider, named "signup@my_domain.com"
有关创建的邮箱,他们发给我的登录名和密码:
For created mailbox, they issued to me login and password:
登录= verbose_login
login = verbose_login
密码= verbose_password
password = verbose_password
余did't完全了解的确切格式:USER_NAME
I did't completely understood the exact format of :user_name.
我应该用
:user_name => "signup@my_domain.com"
或
:user_name => "signup"
或
:user_name => "verbose_login"
或者这个领域是特定于邮件服务器,并且我要问的支持托管服务提供商的?
Or this field is specific to the mail server, and i must ask support of hosting provider ?
和之间有什么区别:认证=>:朴实:登录
And what the difference between :authentication => :plain and :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
}
更多信息这里
切赫
这篇关于网:: SMTPAuthenticationError 502 5.5.2 Rails中的ActionMailer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!