# Emails Not Sending from Production Server; Send Perfectly Fine from Development Server

**URL:** <https://forum.djangoproject.com/t/emails-not-sending-from-production-server-send-perfectly-fine-from-development-server/34204>\
**Category:** Mystery Errors\
**Created:** [August 26, 2024, 7:23pm UTC](https://forum.djangoproject.com/t/emails-not-sending-from-production-server-send-perfectly-fine-from-development-server/34204 "2024-08-26T19:23:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ialvarez540](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/ialvarez540/32/23483_2.png) [@ialvarez540](https://forum.djangoproject.com/u/ialvarez540)\
**Post date:** [August 26, 2024, 7:23pm UTC](https://forum.djangoproject.com/t/emails-not-sending-from-production-server-send-perfectly-fine-from-development-server/34204/1 "2024-08-26T19:23:20Z")

</div>

Hello,

I have been trying to debug this issue for quite a while and no solutions online seem to fix it. I am using an open relay SMTP email server as my host and using port 25 in settings.py. These setting works fine when I am testing locally from my development server and send\_email is successful. However, when I try to send an email from the production server, emails are not sent, and I do not receive any kind of error message.

I’ve found that the logs in the firewall on the SMTP server are never receiving the email from the django website. I’ve tried a few things for debugging as well:

1. I tested to make sure emails are working using that SMTP server per [this post](https://forum.djangoproject.com/t/django-send-mail-not-working-now/27802/2)
2. I implemented the django email log. From this I found that the emails are getting logged but are failing to send.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/3X/b/6/b66b0f8093b5bac551939e5f41e0b3fa60cc7082.png)

Does anyone have a potential solution I could try?

Are there any debugging tips I could apply?

Update: I was able to get an error message from the send\_mail function. Here is the error I’m getting: [SSL: CERTIFICATE\_VERIFY\_FAILED] certificate verify failed: self-signed certificate (\_ssl.c:1000)

Thanks,  
Ivan

---

<div class="post-metadata">

**Author:** ![ialvarez540](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/ialvarez540/32/23483_2.png) [@ialvarez540](https://forum.djangoproject.com/u/ialvarez540)\
**Post date:** [August 27, 2024, 5:18pm UTC](https://forum.djangoproject.com/t/emails-not-sending-from-production-server-send-perfectly-fine-from-development-server/34204/2 "2024-08-27T17:18:18Z")

</div>

SOLUTION FOUND:

Apparently, the problem arises from later Django versions and the solution to the issue is to create your own email backend. The video with the required code can be found on youtube [here](https://www.youtube.com/watch?v=ZbrJjkOX8Ro).

---

<div class="post-metadata">

**Author:** ![Aki](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/aki/32/23877_2.png) [@Aki](https://forum.djangoproject.com/u/Aki)\
**Post date:** [September 13, 2024, 12:27am UTC](https://forum.djangoproject.com/t/emails-not-sending-from-production-server-send-perfectly-fine-from-development-server/34204/3 "2024-09-13T00:27:53Z")

</div>

Avoid port 25 no matter what.  
You can’t establish secure connections on that port as it’s uncryptable. use TLS on 465 or 587.  
It works like a charm with sendmail in Django
