gpt4 book ai didi

ssl - 在 GCP Composer Airflow 中使用 AWS SES SMTP 服务器时出现 "SSL: WRONG_VERSION_NUMBER"

转载 作者:行者123 更新时间:2023-12-04 22:40:00 26 4
gpt4 key购买 nike

我正在使用 GCP Composer (Airflow) 来运行一些计划任务。并使用 AWS SES SMTP 服务器发送通知电子邮件。
根据 GCP Composer 的文档,https://cloud.google.com/composer/docs/secret-manager#configuring_your_environment_withhttps://cloud.google.com/composer/docs/configure-email#configure_third-party_smtp_services ,我将 Airflow 配置覆盖设置如下

secrets
backend airflow.providers.google.cloud.secrets.secret_manager.CloudSecretManagerBackend

smtp
smtp_port 587
smtp_mail_from ...
smtp_host email-smtp.us-west-1.amazonaws.com
smtp_starttls True
smtp_password_secret smtp-password
smtp_ssl True
smtp_user ...
email
email_backend airflow.utils.email.send_email_smtp
Airflow 发送邮件时出错:
Traceback (most recent call last)
File "/usr/local/lib/airflow/airflow/models/taskinstance.py", line 1476, in email_aler
send_email(self.task.email, subject, html_content
File "/usr/local/lib/airflow/airflow/utils/email.py", line 62, in send_emai
mime_subtype=mime_subtype, mime_charset=mime_charset, **kwargs
File "/usr/local/lib/airflow/airflow/utils/email.py", line 108, in send_email_smt
send_MIME_email(smtp_mail_from, recipients, msg, dryrun
File "/usr/local/lib/airflow/airflow/utils/email.py", line 127, in send_MIME_emai
s = smtplib.SMTP_SSL(SMTP_HOST, SMTP_PORT) if SMTP_SSL else smtplib.SMTP(SMTP_HOST, SMTP_PORT
File "/opt/python3.6/lib/python3.6/smtplib.py", line 1031, in __init_
source_address
File "/opt/python3.6/lib/python3.6/smtplib.py", line 251, in __init_
(code, msg) = self.connect(host, port
File "/opt/python3.6/lib/python3.6/smtplib.py", line 336, in connec
self.sock = self._get_socket(host, port, self.timeout
File "/opt/python3.6/lib/python3.6/smtplib.py", line 1039, in _get_socke
server_hostname=self._host
File "/opt/python3.6/lib/python3.6/ssl.py", line 407, in wrap_socke
_context=self, _session=session
File "/opt/python3.6/lib/python3.6/ssl.py", line 817, in __init_
self.do_handshake(
File "/opt/python3.6/lib/python3.6/ssl.py", line 1077, in do_handshak
self._sslobj.do_handshake(
File "/opt/python3.6/lib/python3.6/ssl.py", line 689, in do_handshak
self._sslobj.do_handshake(
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:852
如何解决这个 WRONG_VERSION_NUMBER 错误?

最佳答案

AWS SES SMTP 在端口 587 上启用 SSL 时出现问题。它需要禁用 SSL 才能在端口 587 上工作。
只需设置smtp_sslFalse在 Airflow 的配置设置中。

关于ssl - 在 GCP Composer Airflow 中使用 AWS SES SMTP 服务器时出现 "SSL: WRONG_VERSION_NUMBER",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68687737/

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