I've got Actionmailer sending emails using gmail with the following settings:
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "gmail.com",
:user_name => "[email protected]",
:password => "password",
:authentication => "plain",
:enable_starttls_auto => true
}
However, I can't get office 365 mail to work, I have the following settings:
ActionMailer::Base.smtp_settings = {
:address => "smtp.office365.com",
:port => 587,
:domain => "my_domain.com",
:user_name => "username@my_domain.onmicrosoft.com",
:password => "password",
:authentication => :login,
:enable_starttls_auto => true
}
If I try and send an email with this client I get:
Net::SMTPFatalError
550 5.7.1 Client does not have permissions to send as this sender
Go to the config folder of your emails project and open environment. rb file and add the following line at the bottom of this file. It tells ActionMailer that you want to use the SMTP server. You can also set it to be :sendmail if you are using a Unix-based operating system such as Mac OS X or Linux.
Turns out microsoft requires the same email for both the smtp_settings
and the :from
field in emailer.rb
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With