gpt4 book ai didi

amazon-web-services - Pyramid_exclog : SMTPAuthenticationError: (530, 'Must issue a STARTTLS command first' )

转载 作者:行者123 更新时间:2023-12-01 22:27:24 25 4
gpt4 key购买 nike

我正在使用 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.)

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

啊哈,它甚至提到了“starttls”。

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

关于amazon-web-services - Pyramid_exclog : SMTPAuthenticationError: (530, 'Must issue a STARTTLS command first' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31872336/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com