如何通过代理发送django电子邮件与身份验证

Luc*_*ike 5 python email django proxy

我正在尝试从代理背后的工作PC发送电子邮件.

在settings.py中,我的代码如下所示:

    #email setup
    EMAIL_USE_TLS = True
    EMAIL_HOST = 'smtp.gmail.com'
    EMAIL_HOST_USER = 'username@gmail.com'
    EMAIL_HOST_PASSWORD = 'password'
    EMAIL_PORT = 587
Run Code Online (Sandbox Code Playgroud)

在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)
Run Code Online (Sandbox Code Playgroud)

这给出了错误:

    [Errno 10061] No connection could be made because the target machine actively refused it
Run Code Online (Sandbox Code Playgroud)

如何使用代理实现身份验证?