airflow.providers.amazon.aws.hooks.ses

此模块包含 AWS SES Hook。

SesHook

与 Amazon Simple Email Service 交互。

模块内容

class airflow.providers.amazon.aws.hooks.ses.SesHook(*args, **kwargs)[source]

基类: airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook

与 Amazon Simple Email Service 交互。

提供对 boto3.client("ses") 的轻量级封装。

可以指定附加参数(例如 aws_conn_id),这些参数将传递给底层的 AwsBaseHook。

send_email(mail_from, to, subject, html_content, files=None, cc=None, bcc=None, mime_subtype='mixed', mime_charset='utf-8', reply_to=None, return_path=None, custom_headers=None)[source]

使用 Amazon Simple Email Service 发送电子邮件。

参数:
  • mail_from (str) – 设置为电子邮件发件人地址

  • to (str | collections.abc.Iterable[str]) – 设置为电子邮件收件人地址列表

  • subject (str) – 电子邮件主题

  • html_content (str) – HTML 格式的电子邮件内容

  • files (list[str] | None) – 要附加的文件路径列表

  • cc (str | collections.abc.Iterable[str] | None) – 设置为电子邮件抄送 (CC) 地址列表

  • bcc (str | collections.abc.Iterable[str] | None) – 设置为电子邮件密送 (BCC) 地址列表

  • mime_subtype (str) – 可用于指定消息的子类型。默认为 mixed

  • mime_charset (str) – 电子邮件字符集。默认为 UTF-8。

  • return_path (str | None) – 用于接收回复的电子邮件地址。默认情况下,回复将发送到原始发件人的电子邮件地址。

  • reply_to (str | None) – 应发送邮件退信和投诉的电子邮件地址。“Return-Path” 有时也被称为“envelope from”、“envelope sender”或“MAIL FROM”。

  • custom_headers (dict[str, Any] | None) – 要添加到 MIME 消息的附加标头。这些值不会运行验证,并且应该能够进行编码。

返回值:

来自 Amazon SES 服务的响应,包含唯一的邮件标识符。

返回类型:

dict

此条目有帮助吗?