Ruby on rails Mercury邮件服务器与Rails的身份验证
我正在运行Mercury SMTP服务器(与我的XAMPP堆栈一起提供),并试图让我的Rails应用程序在开发模式下使用它。因此,我在development.rb文件中添加了以下内容Ruby on rails Mercury邮件服务器与Rails的身份验证,ruby-on-rails,smtp,actionmailer,Ruby On Rails,Smtp,Actionmailer,我正在运行Mercury SMTP服务器(与我的XAMPP堆栈一起提供),并试图让我的Rails应用程序在开发模式下使用它。因此,我在development.rb文件中添加了以下内容 ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.perform_deliveries = true ActionMailer::Base.raise_delivery_errors = true ActionMailer::Ba
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.smtp_settings = {
:address => "localhost",
:port => 25,
:domain => 'localhost',
:user_name=>'newuser@localhost',
:password=>'wampp',
:authentication => :plain,
:enable_starttls_auto => true
}
当我将身份验证参数设置为plain时,我得到:
504 Unknown or unsupported authentication method.
所以我查看了ActionMailerAPI,发现还有两个选项login和cram_md5。如果我使用我得到的任何一个
501 Authentication failed - bad user or password.
用户名/密码组合是默认值,因此绝对有效。我尝试过newuser,有@localhost和没有@localhost,甚至创建了一个新的Mercury用户帐户(我有其他原因不这么做),有@localhost和没有@localhost都尝试过,我总是得到501
如果可能的话,我想在Rails端实现这一点,而不是在Mercury中实现简单的身份验证,但如果有人知道如何实现这一点,我想我会接受这个解决方案。最坏的情况下,我将推荐一个不同的SMTP服务器用于Rails开发
谢谢 将Mercury SMTP服务器配置为不需要身份验证。也许这是默认值 对于Rails smtp设置,请使用:
ActionMailer::Base.smtp_settings = {
:address => "localhost",
:port => 25
}
这是我在ApacheJames服务器上使用的配置。当不需要身份验证时,必须省略大多数参数