# Unable send email from the django using office 365

**URL:** <https://forum.djangoproject.com/t/unable-send-email-from-the-django-using-office-365/21566>\
**Category:** Forms & APIs\
**Created:** [June 12, 2023, 9:38pm UTC](https://forum.djangoproject.com/t/unable-send-email-from-the-django-using-office-365/21566 "2023-06-12T21:38:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![galp77](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/galp77/32/14190_2.png) [@galp77](https://forum.djangoproject.com/u/galp77)\
**Post date:** [June 12, 2023, 9:38pm UTC](https://forum.djangoproject.com/t/unable-send-email-from-the-django-using-office-365/21566/1 "2023-06-12T21:38:19Z")

</div>

Unable to send email from Django using Office 365,

EMAIL\_BACKEND = ‘django.core.mail.backends.smtp.EmailBackend’

EMAIL\_PORT = 587

EMAIL\_USE\_TLS = True

MAIL\_HOST = ‘[smtp.office365.com](http://smtp.office365.com)’

EMAIL\_HOST\_USER = ‘pepito.perez@example.com’

EMAIL\_HOST\_PASSWORD = ‘something’

I test using the three Microsoft options on this web and nothing, I did use Gmail and I get no issues but office365 I was not able.

> **[How to set up a multifunction device or application to send email using...](https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365)**
>
> Learn how to set up printers, scanners, LOB applications to send email using Microsoft 365 or Office 365.

---

<div class="post-metadata">

**Author:** ![Rigo-Villalta](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rigo-villalta/32/5667_2.png) [@Rigo-Villalta](https://forum.djangoproject.com/u/Rigo-Villalta)\
**Post date:** [June 14, 2023, 9:12pm UTC](https://forum.djangoproject.com/t/unable-send-email-from-the-django-using-office-365/21566/2 "2023-06-14T21:12:03Z")

</div>

Office 365 has lot of filters and I think is one of the most complicated platforms in order to use email as a service.

Do you need to use this service? You can use other providers in order to function with Django and keep your normal mail with Office 365.

---

<div class="post-metadata">

**Author:** ![Amala4](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/amala4/32/15910_2.png) [@Amala4](https://forum.djangoproject.com/u/Amala4)\
**Post date:** [September 14, 2023, 7:36pm UTC](https://forum.djangoproject.com/t/unable-send-email-from-the-django-using-office-365/21566/4 "2023-09-14T19:36:49Z")

</div>

Did you solve this, I have the same issue

---

<div class="post-metadata">

**Author:** ![mirunijoel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/mirunijoel/32/5193_2.png) [@mirunijoel](https://forum.djangoproject.com/u/mirunijoel)\
**Post date:** [April 1, 2024, 9:16am UTC](https://forum.djangoproject.com/t/unable-send-email-from-the-django-using-office-365/21566/6 "2024-04-01T09:16:33Z")

</div>

Did anyone find a solution on how to sent email using office 365?

all my settings and views are well updated but I kept running into this error  
[Errno 101] Network is unreachable

I have stable internet, on office 365 dashboard, authenticated SMTP has been enabled for this email

I don’t know what other setting is missing here to cause above error

---

<div class="post-metadata">

**Author:** ![galp77](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/galp77/32/14190_2.png) [@galp77](https://forum.djangoproject.com/u/galp77)\
**Post date:** [April 29, 2024, 2:25pm UTC](https://forum.djangoproject.com/t/unable-send-email-from-the-django-using-office-365/21566/7 "2024-04-29T14:25:08Z")

</div>

I got the solution.

Go to Office 356 make an account

After that go to Licenses and app, after that add this license ( Exchange Online (Plan 1) license )

Go to Mail and go to Manage email app, put the check mark on: Authenticated SMTP

Set up your account in Django settings.py

#OFFICE 365  
EMAIL\_BACKEND = ‘django.core.mail.backends.smtp.EmailBackend’  
EMAIL\_HOST = ‘[smtp-mail.outlook.com](http://smtp-mail.outlook.com)’  
EMAIL\_PORT = ‘587’  
EMAIL\_USE\_TLS = True  
EMAIL\_HOST\_USER = ‘your\_account@domain.com’ #the email account need to have Exchange Online (Plan 1) license  
EMAIL\_HOST\_PASSWORD = ‘your\_password’  
DEFAULT\_FROM\_EMAIL = ‘your\_account@domain.com’

---

<div class="post-metadata">

**Author:** ![MarcusL11](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/marcusl11/32/28943_2.png) [@MarcusL11](https://forum.djangoproject.com/u/MarcusL11)\
**Post date:** [April 29, 2024, 4:53pm UTC](https://forum.djangoproject.com/t/unable-send-email-from-the-django-using-office-365/21566/8 "2024-04-29T16:53:12Z")

</div>

> [@galp77](#):
>
> Exchange Online (Plan 1)

I am having the same issue. I bought my domain from [GoDaddy.com](http://GoDaddy.com) and also bought their email service which is using the office 365. The email service comes with the Exchange App, which always takes me to the Exchange admin center. Under Settings \> Mail Flow I uncheck the box “Turn off SMTP AUTH protocol for your organization”.

I’ve also have my settings as the following:

EMAIL\_BACKEND = ‘django.core.mail.backends.smtp.EmailBackend’  
EMAIL\_HOST = ‘[smtp-mail.outlook.com](http://smtp-mail.outlook.com)’  
EMAIL\_PORT = ‘587’  
EMAIL\_USE\_TLS = True  
EMAIL\_HOST\_USER = ‘your\_account@domain.com’  
EMAIL\_HOST\_PASSWORD = ‘your\_password’  
DEFAULT\_FROM\_EMAIL = ‘your\_account@domain.com’

I wasn’t able to get it to work, or send emails successfully. I was getting a "“POST /sign-in/ HTTP/1.1” 500 145 " Error.

Any ideas?
