Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails actionmailer, gmail works, office 365 does not.

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
like image 797
Darkstarone Avatar asked Oct 01 '14 22:10

Darkstarone


People also ask

How do I send an email to ROR?

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.


1 Answers

Turns out microsoft requires the same email for both the smtp_settings and the :from field in emailer.rb.

like image 200
Darkstarone Avatar answered Oct 27 '22 16:10

Darkstarone