Pyramid_exclog:SMTPAuthenticationError:(530,“必须首先发出STARTTLS命令") [英] Pyramid_exclog : SMTPAuthenticationError: (530, 'Must issue a STARTTLS command first')

查看:155
本文介绍了Pyramid_exclog:SMTPAuthenticationError:(530,“必须首先发出STARTTLS命令")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用pyramid_exclog记录异常并将这些异常作为电子邮件发送.我正在使用Amazon aws SMTP发送电子邮件.但出现以下错误:

I'm using pyramid_exclog to log exceptions and send those exceptions as email. I'm using Amazon aws SMTP to send emails. But I'm getting the following error:

SMTPAuthenticationError: (530, 'Must issue a STARTTLS command first')

这是我使用的代码:

[handler_email_exc_handler]
class = handlers.SMTPHandler
args = (('email-smtp.us-east-1.amazonaws.com', 587), 'no-reply@company.com', ['me@company.com'], 'Company Exception' ,('<username>','<user_key>'),None)
level = ERROR
formatter = exc_formatter

据我所知,aws凭证没有任何问题,因为我使用它们通过Thunderbird发送邮件.

As far as I know, there's nothing wrong with the aws credentials, since I used them to send mails via Thunderbird.

推荐答案

这不是凭据,至少不是根据此错误消息.您正在尝试不使用TLS就将SMTP与SES进行对话-您正在尝试通过未加密的连接对自己进行身份验证.这是不安全的,因为它可能会损害您的凭据,因此不受支持.

It isn't the credentials, at least not according to this error message. You are trying to speak SMTP to SES without using TLS -- you are trying to authenticate yourself over an unencrypted connection. This isn't secure, as it could result in the compromise of your credentials, so it isn't supported.

Amazon SES SMTP终端节点要求使用传输层安全性(TLS)对所有连接进行加密.(请注意,TLS通常使用其前身协议的名称SSL来指代.)Amazon SES支持两种建立TLS加密连接的机制:STARTTLS和TLS Wrapper.查看软件的文档,以确定它是否支持STARTTLS,TLS Wrapper或同时支持这两者.

The Amazon SES SMTP endpoint requires that all connections be encrypted using Transport Layer Security (TLS). (Note that TLS is often referred to by the name of its predecessor protocol, SSL.) Amazon SES supports two mechanisms for establishing a TLS-encrypted connection: STARTTLS and TLS Wrapper. Check the documentation for your software to determine whether it supports STARTTLS, TLS Wrapper, or both.

如果您的软件不支持STARTTLS或TLS Wrapper,则可以使用开源stunnel程序设置加密连接(称为安全隧道"),然后使用安全隧道连接到Amazon SES SMTP终端节点

If your software does not support STARTTLS or TLS Wrapper, you can use the open source stunnel program to set up an encrypted connection (called a "secure tunnel"), then use the secure tunnel to connect to the Amazon SES SMTP endpoint.

http://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-connect.html

我不是Python使用者,但是快速检查一下Google机器就会发现:

I am not a Python person, but a quick check of the Google machine suggests this:

要指定使用安全协议(TLS),请将一个元组传递给secure参数.仅在提供身份验证凭据时使用.该元组应该是一个空元组,或者是一个具有密钥文件名的单值元组,或者是一个具有密钥文件和证书文件名的二值元组.(此元组传递到smtplib.SMTP.starttls()方法.)

To specify the use of a secure protocol (TLS), pass in a tuple to the secure argument. This will only be used when authentication credentials are supplied. The tuple should be either an empty tuple, or a single-value tuple with the name of a keyfile, or a 2-value tuple with the names of the keyfile and certificate file. (This tuple is passed to the smtplib.SMTP.starttls() method.)

https://docs.python.org/2/library/logging.handlers.html

啊哈,甚至提到"starttls".

Aha, it even mentions "starttls."

如果我找到了正确的引用,则也许您的最后一个参数应该是()而不是 None ,因为您不需要密钥文件或证书文件.

If I've found the right reference, perhaps your last argument should be () instead of None, since you shouldn't need a keyfile or certificate file.

这篇关于Pyramid_exclog:SMTPAuthenticationError:(530,“必须首先发出STARTTLS命令")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆