airflow.providers.smtp.operators.smtp

EmailOperator

发送一封电子邮件。

模块内容

class airflow.providers.smtp.operators.smtp.EmailOperator(*, to, subject=None, html_content=None, from_email=None, files=None, cc=None, bcc=None, mime_subtype='mixed', mime_charset='utf-8', conn_id='smtp_default', custom_headers=None, **kwargs)[source]

基类: airflow.models.BaseOperator

发送一封电子邮件。

参数:
  • to (list[str] | str) – 要发送电子邮件的收件人列表。(模板化)

  • from_email (str | None) – 发送电子邮件的发件人。(模板化)

  • subject (str | None) – 电子邮件的主题行。(模板化)

  • html_content (str | None) – 电子邮件内容,允许使用 HTML 标记。(模板化)

  • files (list | None) – 电子邮件中要附加的文件名。(模板化)

  • cc (list[str] | str | None) – 要添加到抄送(CC)字段的收件人列表。(模板化)

  • bcc (list[str] | str | None) – 要添加到密送(BCC)字段的收件人列表。(模板化)

  • mime_subtype (str) – MIME 子内容类型

  • mime_charset (str) – 添加到 Content-Type 标头的字符集参数。

  • custom_headers (dict[str, Any] | None) – 要添加到 MIME 消息中的额外标头。

template_fields: collections.abc.Sequence[str] = ('to', 'from_email', 'subject', 'html_content', 'files', 'cc', 'bcc')[source]
template_fields_renderers[source]
template_ext: collections.abc.Sequence[str] = ('.html',)[source]
ui_color = '#e6faf9'[source]
to[source]
subject = None[source]
html_content = None[source]
from_email = None[source]
files = [][source]
cc = None[source]
bcc = None[source]
mime_subtype = 'mixed'[source]
mime_charset = 'utf-8'[source]
conn_id = 'smtp_default'[source]
custom_headers = None[source]
execute(context)[source]

创建操作符时派生。

上下文与渲染 jinja 模板时使用的字典相同。

请参阅 get_template_context 获取更多上下文。

此条目有帮助吗?