小编P11*_*D8M的帖子

如何发送多个收件人sendgrid V3 API Python

任何人都请帮忙,我正在起诉sendgrid v3 api。但是我找不到任何将电子邮件发送给多个收件人的方法。预先感谢。

    import sendgrid
    from sendgrid.helpers.mail import *

    sg = sendgrid.SendGridAPIClient(apikey="SG.xxxxxxxx")
    from_email = Email("FROM EMAIL ADDRESS")
    to_email = Email("TO EMAIL ADDRESS")
    subject = "Sending with SendGrid is Fun"
    content = Content("text/plain", "and easy to do anywhere, even with Python")
    mail = Mail(from_email, subject, to_email, content)
    response = sg.client.mail.send.post(request_body=mail.get())
    print(response.status_code)
    print(response.body)
    print(response.headers)
Run Code Online (Sandbox Code Playgroud)

我想发送电子邮件给多个收件人。就像to_mail =“ xxx@gmail.com,yyy@gmail.com”。

python-3.x sendgrid

4
推荐指数
6
解决办法
2328
查看次数

标签 统计

python-3.x ×1

sendgrid ×1