AWS Pinpoint针对SignInWithApple用户发送电子邮件时,可能会出现SMTPAuthorizationError错误。此错误可能是由于未启用“Less Secure App Access”选项导致的。要解决此问题,可按照以下步骤进行设置:
登录您的电子邮件帐户,然后转到“安全性”设置。
启用“Less Secure App Access”选项。
保存更改并尝试重新启动AWS Pinpoint进行电子邮件发送。
以下是Python代码示例,展示如何在向SignInWithApple用户发送电子邮件时应用此设置:
import boto3
# 初始化AWS Pinpoint客户端
client = boto3.client('pinpoint', region_name='us-east-1')
# 将Less Secure App Access设置为True
response = client.update_email_identity(
EmailIdentity='example@example.com',
EmailAuthenticationMethod='EMAIL_AUTHENTICATION_METHOD',
ConfigurationSetName='CONFIGURATION_SET_NAME',
SendingEnabled=True,
DkimSigningEnabled=True,
MailFromDomain='example.com',
Tags={
'example': 'tag'
},
ForceCreation=True,
FeedbackForwardingEnabled=True,
DeliveryOptions={
'TlsPolicy': 'REQUIRE'
},
// 设置为True
BehaviorOnMXFailure='USE_DEFAULT_VALUE',
// 设置为True
IsLessSecureAppAccessEnabled=True
)