[GeoNode-devel] Sending emails using Exchange 2013 server and NTLM authentication

EFTAS Fabian Wilske fabian.wilske at eftas.com
Fri Apr 17 09:55:32 PDT 2020

Dear all,

I'm using GeoNode 2.10.x and want to send mails by using an Exchange 2013 server which only supports NTLM for SMTP authentification. I realized that the default email backend in GeoNode `django.core.mail.backends.smtp.EmailBackend` only supports LOGIN, PLAIN or CRAM-MD5 for authentication. Luckily, I found another backend (https://github.com/shadiakiki1986/django-smtp-ntlm-backend) for NTLM authentication. But it does not work.

I did the following in the Python shell:

>>> from django.core.mail import send_mail
>>> send_mail('test subject', 'message', 'email at address.com', ['recipient at gmail.com'], fail_silently=False,)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/django/core/mail/__init__.py", line 62, in send_mail
    return mail.send()
  File "/usr/local/lib/python2.7/site-packages/django/core/mail/message.py", line 348, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/usr/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 111, in send_messages
    sent = self._send(message)
  File "/usr/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 127, in _send
    self.connection.sendmail(from_email, recipients, message.as_bytes(linesep='\r\n'))
  File "smtplib.py", line 736, in sendmail
  File "smtplib.py", line 470, in rset
    return self.docmd("rset")
  File "smtplib.py", line 395, in docmd
    return self.getreply()
  File "smtplib.py", line 369, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed

Relevant settings in settings.py:


The settings for the mail server are correct and the mail server is working fine. I am able to send mails with a SMTP testing tool called Swaks with the same settings using the same mail server. Does anybody has experience with using Exchange and NTLM authentication for sending emails with GeoNode? Or is there any other email backend I can use? I'm grateful for any hints.

Best regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-devel/attachments/20200417/793f60e9/attachment.html>

More information about the geonode-devel mailing list