- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 pyramid_exclog 记录异常并将这些异常作为电子邮件发送。我正在使用 Amazon aws SMTP 发送电子邮件。但是我收到以下错误:
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 发送邮件。
最佳答案
这不是凭据,至少根据此错误消息不是。您正在尝试在不使用 TLS 的情况下与 SES 进行 SMTP 通信——您正在尝试通过未加密的连接验证您自己的身份。这不安全,因为它可能会导致您的凭据泄露,因此不受支持。
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.
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 机器表明:
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.)
啊哈,它甚至提到了“starttls”。
如果我找到了正确的引用,也许您的最后一个参数应该是 ()
而不是 None
,因为您不需要 key 文件或证书文件。
关于amazon-web-services - Pyramid_exclog : SMTPAuthenticationError: (530, 'Must issue a STARTTLS command first' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31872336/
我是一名优秀的程序员,十分优秀!