【问题标题】:Mandrill API to send email with recipients(cc), but It also send mail to recipients(cc) as 'TO' using Django==1.11.10Mandrill API 与收件人(cc)一起发送电子邮件,但它也使用 Django==1.11.10 将邮件作为“TO”发送给收件人(cc)
【发布时间】:2022-07-19 06:33:02
【问题描述】:

代码:

def send_mandrill_subscribe_wac(link,user_email, from_user, from_email='examplecc@abc.com'):
   mandrill_client = mandrill.Mandrill(MANDRILL_API_KEY)
   #template_name = "Invited-user-email-for-someone-without-an-account"
   template_name = "invited-user-email-for-someone-without-an-account"
   template_content = [{'content': 'example content', 'name': 'example name'}]
   message = {
       'from_email': 'examplecc@abc.com',
       'to': [
           {
               'email': user_email,
               'type': 'to'
           },
           {
               'email': from_email,
               'type': 'cc'
           },
           {
               'email': 'examplecc2@abc.com',
               'type': 'cc'
           }
       ],
       'global_merge_vars': [
           {'content': user_email},
           {'name': "redirect_link", 'content': link},
           {'name': 'from_user', 'content': from_user}
       ],
      
   }

   return mandrill_client.messages.send_template(template_name=template_name, template_content=template_content, message=message)

在官方文档中他们提到将preserve_recipients设置为True来发送收件人,但不知道在哪里添加这个参数。

需要帮助

【问题讨论】:

    标签: python django mailchimp mandrill


    【解决方案1】:

    preserve_recipients 是我在 https://mailchimp.com/developer/transactional/api/messages/send-new-message/ 看到的消息的属性

    message = {
           'from_email': 'examplecc@abc.com',
           'preserve_recipients': true, 
    

    【讨论】:

      猜你喜欢
      • 2012-04-16
      • 2019-05-04
      • 2019-07-16
      • 2016-03-14
      • 2012-07-02
      • 2019-06-17
      • 2018-11-19
      • 2012-05-25
      • 2023-04-06
      相关资源
      最近更新 更多