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

时间:2014-09-26 16:23:14

标签: python django email 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

在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)

这给出了错误:

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

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

0 个答案:

没有答案