Sendgrid Python回复电子邮件

问题描述 投票:0回答:1

使用reply_to时出现错误,这是我尝试过的...

此方法有效,但没有reply_to:

mail = Mail(
    from_email = from_email,
    to_emails = to_email,
    subject = subject,
    html_content = content)
response = sg.client.mail.send.post(request_body=mail.get())

而且我已经尝试过了:

mail = Mail(
    reply_to = reply,
    from_email = from_email,
    to_emails = to_email,
    subject = subject,
    html_content = content)
response = sg.client.mail.send.post(request_body=mail.get())

这叫声:

TypeError:init()得到了意外的关键字参数'reply_to'

我也曾尝试在Mail()之后添加此内容:

mail.from_EmailMessage(reply_to=ReplyTo(Email(email=ANS_EMAIL,name='Mr X')))

哪个抛出:

TypeError:类型为'Email'的对象没有len()

和:

mail.reply_to(ReplyTo(email=ANS_EMAIL,name='Mr X'))

哪个抛出:

TypeError:'NoneType'对象不可调用

请帮助吗?

python class email sendgrid reply
1个回答
0
投票
由于您的错误状态,reply_to不被接受。创建邮件对象后,尝试设置init()

以下示例:

reply_to

有关如何自定义sendgrid电子邮件对象的更多详细信息-mail.reply_to = "[email protected]"
© www.soinside.com 2019 - 2024. All rights reserved.