Django OSError [Errno 101]

75 views Asked by At

when i test my project on my local machine it was work butt when i deploy my code on my host after submit form data i get this error and i don't receive email.

settings.py:

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

EMAIL_HOST_USER = '[email protected]'

EMAIL_HOST = 'smtp.gmail.com'

EMAIL_PORT = 587

EMAIL_USE_TLS = True

EMAIL_HOST_PASSWORD = "*********"

views.py:

send_mail(
            'همکاری با ما',
            'name: {}\n, age: {}\n, cell_phone: {}\n, email: {}\n, skills: {}\n, message: {}\n'.format(
                name, age, cell_phone, email, dev_skills_str, description),
            settings.EMAIL_HOST_USER,
            ['[email protected]']
        )

error massage:

OSError at /vanguard_projects/project_request
[Errno 101] Network is unreachable
Request Method: POST
Request URL:    http://vanguard-group.ir/vanguard_projects/project_request
Django Version: 3.1.3
Exception Type: OSError
Exception Value:    
[Errno 101] Network is unreachable
Exception Location: /opt/alt/python37/lib64/python3.7/socket.py, line 716, in create_connection
Python Executable:  /home/vanguard/virtualenv/vanguard_land/3.7/bin/python3.7_bin
Python Version: 3.7.8
Python Path:    
['/home/vanguard/vanguard_land',
 '/opt/passenger-5.3.7-9.el7.cloudlinux/src/helper-scripts',
 '/home/vanguard/virtualenv/vanguard_land/3.7/lib64/python37.zip',
 '/home/vanguard/virtualenv/vanguard_land/3.7/lib64/python3.7',
 '/home/vanguard/virtualenv/vanguard_land/3.7/lib64/python3.7/lib-dynload',
 '/opt/alt/python37/lib64/python3.7',
 '/opt/alt/python37/lib/python3.7',
 '/home/vanguard/virtualenv/vanguard_land/3.7/lib/python3.7/site-packages']
Server time:    Tue, 24 Nov 2020 13:27:01 +0000

0

There are 0 answers