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

Francesco Bartoli xbartolone at gmail.com
Sat Apr 18 02:36:07 PDT 2020

I cannot figure out how this would be related to GeoNode. I strongly believe that it is a general question for a django user mailing list or StackOverFlow

Il 17 apr 2020, 21:45 +0200, EFTAS Fabian Wilske <fabian.wilske at eftas.com>, ha scritto:
> 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
>     self.rset()
>   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:
> EMAIL_BACKEND=django_smtp_ntlm_backendNTLMEmail
> EMAIL_HOST=<mailserver>
> EMAIL_HOST_USER=<domain>\<user>
> DEFAULT_FROM_EMAIL=<from-email>
> 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
> Fabian
> _______________________________________________
> geonode-devel mailing list
> geonode-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/geonode-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-devel/attachments/20200418/5e42feb5/attachment.html>

More information about the geonode-devel mailing list