How to send django email through proxy with authentication

I am trying to send an email from a work PC that is behind a proxy server.

In settings.py, my code looks like this:

    #email setup
    EMAIL_USE_TLS = True
    EMAIL_HOST = 'smtp.gmail.com'
    EMAIL_HOST_USER = 'username@gmail.com'
    EMAIL_HOST_PASSWORD = 'password'
    EMAIL_PORT = 587

      

In views.py:

    from django.core.mail import send_mail

    def home(request):
        context = RequestContext(request)
        send_mail('test email', 'hello world', 'sender@gmail.com', ['receiver@email.com'], fail_silently=False)
        return render_to_response('project/home.html', context)

      

This gives an error:

    [Errno 10061] No connection could be made because the target machine actively refused it

      

How can I implement proxy authentication?

+3


source to share





All Articles