Office 365 Email Notification Settings

Added by Alex Wade about 9 years ago

Hi all,

I've tried just about every combination of email settings to authenticate with Office 365 and have had no luck. Has anybody else been able to get it to work? I get "Unrecognized Authentication Type" when sending a test email.

Here's one of my latest attempts:

default:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      #tls: true
      enable_starttls_auto: false
      openssl_verify_mode: none
      address: "smtp.office365.com" 
      port: 587
      domain: "smtp.office365.com" 
      authentication: plain
      user_name: "redmine@mycompany.com" 
      password: "thepassword" 

Server EHLO response below.

250-XXXX.outlook.office365.com Hello [X.X.X.X]
250-SIZE 36700160
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-AUTH
250-8BITMIME
250-BINARYMIME
250 CHUNKING

Replies (14)

RE: Office 365 Email Notification Settings - Added by Bonnie O almost 9 years ago

The settings below worked for me.

production:
email_delivery:
smtp_settings:
address: smtp.office365.com
port: 587
domain: smtp.office365.com
authentication: :login
user_name:
password: mypassword
enable_starttls_auto: true

RE: Office 365 Email Notification Settings - Added by Pedro Melo over 7 years ago

These setting worked for me too, thanks a lot!

RE: Office 365 Email Notification Settings - Added by Bernhard Schulz about 2 years ago

I can confirm, that today (July 2020) the settings from Bonnie O from 2013 are still working.

RE: Office 365 Email Notification Settings - Added by Celso Acurcio almost 2 years ago

I can't for the life of me make this work.
No matter what options I select I always get an error, I think that the closest setting I can get I still get an authentication error:

An error occurred while sending mail (535 5.7.3 Authentication unsuccessful [LO2P123CA0098.GBRP123.PROD.OUTLOOK.COM] )

I tried many different options and followed many different online forums and instructions but none work, I'm starting to wonder if this is due to the 2FA on my account and if there's a way to go around it somehow.
My settings are as follows:

production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: smtp.office365.com
port: 587
domain: smtp.office365.com
authentication: :login
user_name:
password: mypass
enable_starttls_auto: true
openssl_verify_mode: none

Please help.

RE: Office 365 Email Notification Settings - Added by Celso Acurcio almost 2 years ago

Just trying to get help again here, this is still not ok for me.
I've tried with and without quotation marks in everything, disabled the 2FA in this account and it's still unsuccessful.
Is there any other factor that may be causing this?
I have the exact same spacing as Bonnie O and lines (with the exception of username and pass).
Is there any way I can try to establish the connection manually to see in which step it fails? something that provides a more detailed fault information?

My gmail configuration works perfectly fine with the official redmine instructions, why is office365 not working with those?

RE: Office 365 Email Notification Settings - Added by Sebastian Bilda over 1 year ago

Hi,

i have the same problem here and it still not working.
I have tried the configurations that are mentioned above and also activated the external SMTP access for the specific account. Also configured the action_mailer.perform_deliveries to true.

The message that i get is always "execution expired". No authentication error or something else.

Did i miss something? Should be 2FA disabled?

RE: Office 365 Email Notification Settings - Added by Celso Acurcio over 1 year ago

Yes, I have fought with this issue as well and it's now solved.
Create a dedicated email just for this so you can disable 2FA and follow the links I provided so that this email allows access from "unsafe applications" and it will work.
It's better that you limit this account for redmine only as you will disable all safety features basically.

RE: Office 365 Email Notification Settings - Added by David Farrick 8 months ago

ok, I'm stuck. I have tried Bonnie's settings in a few different ways. I have the SMTP authentication off for a dedicated redmine email account.

Problem #1:
1) where is the best place to look for the error log? I have looked in the /var/log/apache2/error.log file and at the end I receive this message: "Cannot checkout session because a spawning error occurred. The identifier of the error is 797b41ed. Please see earlier logs for details about the error."
2) The passenger error file referenced above states
"error_title">Web application could not be started<
did not find expected key while parsing a block mapping at line 29 column

Any help would be appreciated.

RE: Office 365 Email Notification Settings - Added by David Farrick 8 months ago

I edited {redmine root dir}/config/application.rb and changed config.action_mailer.perform_deliveries = false to true and rebooted. Now I can see the parameters under Administration -> Settings -> Email Notifications. I believe that fixed the error above.

When I attempt to send a test email, I am receiving the "An error occurred while sending mail (Connection refused - connect(2) for "localhost" port 25)" message. Why am I getting port 25 error when I set port 587? I can't find an error log that details the problem.

Any ideas?

RE: Office 365 Email Notification Settings - Added by hsc solutions 8 months ago

We noticed that Microsoft recently changed the core authentication type to just accept oauth2 authentication.
I dont know if thats your problem, but you may check this: https://docs.microsoft.com/de-de/lifecycle/announcements/exchange-online-basic-auth-deprecated

RE: Office 365 Email Notification Settings - Added by David Farrick 8 months ago

Thanks "hsc solutions" but I don't think that the oath2 change is the problem. I have the SMTP Authentication turned off on this dedicated email account for Redmine. This is needed for devices such as MFP, scanners, etc to connect. I don't see Redmine as different than other "device-like" connections.

I'm wondering if there isn't something I need to do with Ruby to set the action mailer to my server, office365. Otherwise, why do I keep getting the message 'failed to connect to "localhost"'? I have in the config yml the "smtp.office365.com" server. Why isn't it picking this up? Or is the error message somehow hardcoded into Redmine?

RE: Office 365 Email Notification Settings - Added by David Farrick 8 months ago

Also, I just tried with my personal postfix + dovecot email server using the recommended SMTP settings and I still am getting the "(Connection refused - connect(2) for "localhost" port 25)" message.

So the problem doesn't appear to be in the configuration.yml settings. The problem seems to be somewhere else???

(1-14/14)