django - Python - Send email error connection timeout -


i got error message when server trying send email user.

error log message

traceback (most recent call last):   file "/usr/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 177, in __call__     response = self.get_response(request)   file "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 230, in get_response     response = self.handle_uncaught_exception(request, resolver, sys.exc_info())   file "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 284, in handle_uncaught_exception     'request': request   file "/usr/lib64/python2.7/logging/__init__.py", line 1175, in error     self._log(error, msg, args, **kwargs)   file "/usr/lib64/python2.7/logging/__init__.py", line 1268, in _log     self.handle(record)   file "/usr/lib64/python2.7/logging/__init__.py", line 1278, in handle     self.callhandlers(record)   file "/usr/lib64/python2.7/logging/__init__.py", line 1318, in callhandlers     hdlr.handle(record)   file "/usr/lib64/python2.7/logging/__init__.py", line 749, in handle     self.emit(record)   file "/usr/lib/python2.7/site-packages/django/utils/log.py", line 117, in emit     self.send_mail(subject, message, fail_silently=true, html_message=html_message)   file "/usr/lib/python2.7/site-packages/django/utils/log.py", line 120, in send_mail     mail.mail_admins(subject, message, *args, connection=self.connection(), **kwargs)   file "/usr/lib/python2.7/site-packages/django/core/mail/__init__.py", line 97, in mail_admins     mail.send(fail_silently=fail_silently)   file "/usr/lib/python2.7/site-packages/django/core/mail/message.py", line 292, in send     return self.get_connection(fail_silently).send_messages([self])   file "/usr/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 100, in send_messages     new_conn_created = self.open()   file "/usr/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 58, in open     self.connection = connection_class(self.host, self.port, **connection_params)   file "/usr/lib64/python2.7/smtplib.py", line 255, in __init__     (code, msg) = self.connect(host, port)   file "/usr/lib64/python2.7/smtplib.py", line 315, in connect     self.sock = self._get_socket(host, port, self.timeout)   file "/usr/lib64/python2.7/smtplib.py", line 290, in _get_socket     return socket.create_connection((host, port), timeout)   file "/usr/lib64/python2.7/socket.py", line 571, in create_connection     raise err socket.error: [errno 110] connection timed out [pid: 16437|app: 0|req: 71/132] 88.157.165.166 () {54 vars in 1125 bytes} [wed sep  6 10:02:03 2017] post /company/accounts/register/ => generated 0 bytes in 254703 msecs (http/1.1 500) 0 headers in 0 bytes (0 switches on core 0) 

my code

send_mail('new employer account created', '''new account has been created on xxxxx! company name: ''' + user_profile.company_name + ''' contact person: ''' + user_profile.name + ''' email: ''' + user_profile.user.email + ''' phone no: ''' + user_profile.company_phone_number + ''' - xxxxx''', 'no-reply@xxxxx.com.my', ['alerts@xxxxx.com.my'], fail_silently=false) 

please advice. thank you.

try use smtp service sendgrid. faced error using gmail , zoho smtp worked smoothly sendgrid smtp. free basic usage.

hope helps.!!!


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -