Trying to send an email from apache airflow using AWS Simple Email Service (SES), and it's returning errors that are not helping me solve the problem. I believe it's a configuration issue within SES, but I'm not sure what to change.
General info:
Abbreviated DAG code:
...
from airflow.operators.email_operator import EmailOperator
...
email_status = EmailOperator(
task_id="sending_status_email",
to="[email protected]",
subject="Test from SES",
html_content="Trying to send an email from airflow through SES.",
dag=dag
)
...
airflow.cfg SMTP Settings:
smtp_host = email-smtp.us-east-1.amazonaws.com
smtp_starttls = True
smtp_ssl = False
smtp_user = AWSUSERKEY
smtp_password = PASSWORDFROMAWSSMTP
smtp_port = 587
smtp_mail_from = [email protected]
Errors Received while trying various changes to starttls, ssl, and port settings.
ERROR - (554, b'Transaction failed: Unsupported encoding us_ascii.')
ERROR - STARTTLS extension not supported by server.
ERROR - (SSL: WRONG_VERSION_NUMBER) wrong version number (_ssl.c:852)
Amazon Simple Email Service (SES) is a cost-effective email service built on the reliable and scalable infrastructure that Amazon.com developed to serve its own customer base. With Amazon SES, you can send transactional email, marketing messages, or any other type of high-quality content to your customers.
Not sure about the others but we just ran into this error today:
ERROR - (554, b'Transaction failed: Unsupported encoding us_ascii.')
This is the default value in the class's __init__
method, which isn't valid:
https://github.com/apache/airflow/blob/1.10.10/airflow/operators/email_operator.py#L63
You can fix it by passing in a valid value, like "utf-8":
email_status = EmailOperator(
mime_charset='utf-8',
task_id="sending_status_email",
to="[email protected]",
subject="Test from SES",
html_content="Trying to send an email from airflow through SES.",
dag=dag
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With