使用boto3通过SES发送电子邮件时如何设置重要性优先级
How to set Importance priority when sending email via SES using boto3
我正在使用通过 boto3 调用 SES 服务的 AWS Lambda 函数发送电子邮件。我设法使一切正常,但我想在电子邮件中添加 'important' 优先级。阅读 boto3 api 文档,它没有说明设置优先级。请问有人为SES做过这个吗?下面是调用 boto3 的示例:
import boto3
ses = boto3.client('ses')
email_response = ses.send_email(
Destination={
'BccAddresses': [
],
'CcAddresses': [
],
'ToAddresses': [
email_address
],
},
Message={
'Body': {
'Html': {
'Charset': 'UTF-8',
'Data': html_output,
},
},
'Subject': {
'Charset': 'UTF-8',
'Data': 'My msg'
},
},
Source=SENDER
)
您需要使用 send_raw_email()
方法,因为 SMTP 优先级是 SES-supported 客户 header 字段,但不是作为 boto3 方法参数。
您可以在 SMTP sending an priority email Whosebug 回答中阅读有关 SMTP 优先级字段的更多信息。
我正在使用通过 boto3 调用 SES 服务的 AWS Lambda 函数发送电子邮件。我设法使一切正常,但我想在电子邮件中添加 'important' 优先级。阅读 boto3 api 文档,它没有说明设置优先级。请问有人为SES做过这个吗?下面是调用 boto3 的示例:
import boto3
ses = boto3.client('ses')
email_response = ses.send_email(
Destination={
'BccAddresses': [
],
'CcAddresses': [
],
'ToAddresses': [
email_address
],
},
Message={
'Body': {
'Html': {
'Charset': 'UTF-8',
'Data': html_output,
},
},
'Subject': {
'Charset': 'UTF-8',
'Data': 'My msg'
},
},
Source=SENDER
)
您需要使用 send_raw_email()
方法,因为 SMTP 优先级是 SES-supported 客户 header 字段,但不是作为 boto3 方法参数。
您可以在 SMTP sending an priority email Whosebug 回答中阅读有关 SMTP 优先级字段的更多信息。