问题
In a rails4 application, I am trying to send emails by configuring smtp settings but I am getting the following error:
553 5.7.1 : Sender address rejected: not owned by user admin@mydomain.com
I am using the following settings:
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.mydomain.com",
:port => 25,
:domain => "mydomain.com",
:user_name => "admin@mydomain.com",
:password => "CorrectPassword",
:authentication => :plain,
:enable_starttls_auto => true,
:openssl_verify_mode => 'none'
}
config.action_mailer.default_url_options = {:host => "mydomain.com"}
The same works when I use my gmail account settings. I got my domain from bigrock.com and all MX Records are verified. I am able to send emails manually (by logging in webmail.mydomain.com). This issue has delayed the release of my site by quite a few days. Please Help!
回答1:
As @marc-b commented,
The mail server is rejecting your email because you're trying to send from a username which differs from the username you're logging in as, e.g. you've set the From: to be no-reply@mydomain.com, which is obviously not the same as admin@mydomain.com
And the solution was:
.. You are right. ... I changed the "from" field's value to same as user_name.
来源:https://stackoverflow.com/questions/21816348/553-5-7-1-mydomain-sender-address-rejected-not-owned-by-user-adminmydomain