如何向mandrill发送多条消息

时间:2015-06-18 17:27:01

标签: python mandrill

我有大约1000封独特内容的独特邮件。我想将它们批量发送到mandril,即我不想为我发送的每条消息进行单独的网络呼叫。以下文档显示了api。但它没有定义我想要的东西。

https://mandrillapp.com/api/docs/messages.python.html

我想要什么

mandrill_client = mandrill.Mandrill('YOUR_API_KEY')
    messages ={ message1, message2 ....}

result = mandrill_client.messages.send(messages=messages, async=True, ip_pool='Main Pool', send_at='example send_at')

我找不到上述内容。但这就是我想要的。

1 个答案:

答案 0 :(得分:1)

试试这个

 message = {
      #other details
     'from_email': 'message.from_email@example.com',
     'from_name': 'Example Name',
     'to': [{'email': 'recipient.email@example.com',
             'name': 'Recipient Name',
             'type': 'to'},2nd reciepient,....],
}
result = mandrill_client.messages.send(messages=messages, async=True)