Skip to content

Invalid mime_charset default in send_email utility #9687

@Libum

Description

@Libum

Apache Airflow version: 1.10.10

Kubernetes version (if you are using kubernetes) (use kubectl version): not relevant

Environment: not relevant

  • Cloud provider or hardware configuration: not relevant
  • OS (e.g. from /etc/os-release): not relevant
  • Kernel (e.g. uname -a): not relevant
  • Install tools: not relevant
  • Others: not relevant

What happened:

Airflow is failing to send default task failure email if message contains non-ascii characters. Relevant part from task logs:

Failed to send email to: xxx.xxx@xxx.xxx
'ascii' codec can't encode characters in position 34-35: ordinal not in range(128)

What you expected to happen:

Email to be sent successfully.

Issue is most likely caused by invalid default mime_charset in send_email utility in Airflow 1.10.10:

mime_subtype='mixed', mime_charset='us-ascii',

It is set to 'us-ascii', but I would expect 'utf-8' based on UPDATING.md and current state of master branch:
https://github.com/apache/airflow/blob/v1-10-stable/UPDATING.md#setting-utf-8-as-default-mime_charset-in-email-utils

mime_subtype='mixed', mime_charset='utf-8',

As result emails are not sent, if they contain non-ascii chars.

How to reproduce it:
Run PythonOperator task which is raising Exception with non-ascii message.

Anything else we need to know:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions