# SMTP unrecognized authentication type with Office 365

**URL:** <https://meta.discourse.org/t/smtp-unrecognized-authentication-type-with-office-365/145830>\
**Category:** Self-hosting\
**Tags:** email\
**Created:** [27 במרץ,‏ 2020,‏ 3:34pm UTC](https://meta.discourse.org/t/smtp-unrecognized-authentication-type-with-office-365/145830 "2020-03-27T15:34:14Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![JMadd](https://avatars.discourse-cdn.com/v4/letter/j/7ab992/32.png) [@JMadd](https://meta.discourse.org/u/JMadd)\
**Post date:** [27 באפריל,‏ 2020,‏ 1:22am UTC](https://meta.discourse.org/t/smtp-unrecognized-authentication-type-with-office-365/145830/4 "2020-04-27T01:22:40Z")

</div>

FWIW, here is what I have found. I went into the docker image and started monkeying around with the lib/tasks/emails.rake script and the config/discourse.conf file. Several hours later, after trying every possible combination of [smtp.office365.com](http://smtp.office365.com) and .mail.protection.outlook.com AUTH login and AUTH plain I uncommented the block above the STMP start.

```
# We would like to do this, but Net::SMTP errors out using starttls
#Net::SMTP.start(smtp[:address], smtp[:port]) do |s|
# s.starttls if !!smtp[:enable_starttls_auto] && s.capable_starttls?
# s.auth_login(smtp[:user_name], smtp[:password])
#end

```

Running that as-is resulted in a read timeout.  
Modifying it like this - calling new rather than start resulted in a successful send.

```
Net::STMP.new(smtp[:address], smtp[:port]) do |s|
    s.enable_starttls
    s.auth_login(smtp[:user_name], smtp[:password])
end

```

This is my first exposure to Ruby, rake and friends. I can’t explain why it works or if is a ‘good thing’ for general cases.  
J.

---

_[View the full topic](https://meta.discourse.org/t/smtp-unrecognized-authentication-type-with-office-365/145830)._
