I’m using Django’s smtp backend to send emails and it works on my local system with DEBUG set to false but fails to work on GoDaddy’s servers… I get the Server Error 500 problem and it points towards:-
ConnectionRefusedError at /contact/
[Errno 111] Connection refused
Request Method: POST
Request URL: https://www.placeholder.com/contact/
Django Version: 3.2.7
Exception Type: ConnectionRefusedError
Exception Value:
[Errno 111] Connection refused
Exception Location: /opt/alt/python37/lib64/python3.7/socket.py, line 716, in create_connection
Python Executable: /home/jnb3o6uaake2/virtualenv/APT/3.7/bin/python3.7_bin
Python Version: 3.7.11
Python Path:
['/home/jnb3o6uaake2/APT',
'/opt/cpanel/ea-ruby24/root/usr/share/passenger/helper-scripts',
'/home/jnb3o6uaake2/virtualenv/APT/3.7/lib64/python37.zip',
'/home/jnb3o6uaake2/virtualenv/APT/3.7/lib64/python3.7',
'/home/jnb3o6uaake2/virtualenv/APT/3.7/lib64/python3.7/lib-dynload',
'/opt/alt/python37/lib64/python3.7',
'/opt/alt/python37/lib/python3.7',
'/home/jnb3o6uaake2/virtualenv/APT/3.7/lib/python3.7/site-packages']
Server time: Tue, 21 Sep 2021 12:59:08 +0000
send_mail(subject=subject, message=message,from_email="placeholder@placeholder.com", recipient_list=["placeholder@placeholder.com"] …
▼ Local vars
Variable Value
__class__
<class 'core.views.ContactPageView'>
body
{'Email': 'Email: placeholder@gmail.com',
'Message': '1',
'Name': 'Name: 12',
'Phone': 'Phone: placeholder'}
form
<ContactForm bound=True, valid=True, fields=(name;company;phone;email;message)>
message
'Name: 12\nEmail: placeholder\nPhone: placeholder\n1'
self
<core.views.ContactPageView object at 0x2b04035e45d0>
subject
'Website Inquiry'
The sendmail function is highlighted.
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = 'smtp.rediffmailpro.com'
EMAIL_HOST_USER = 'placeholder@placeholder.com'
EMAIL_HOST_PASSWORD = 'placeholder'
EMAIL_USE_SSL = True
EMAIL_PORT = '465'