【问题标题】:Add Reply To email header in Mailjet API在 Mailjet API 中添加回复电子邮件标头
【发布时间】:2019-01-27 02:57:22
【问题描述】:

如何在 Mailjet API 中添加回复电子邮件标头?还是其他标题?

Google 搜索显示属性 ReplyEmail,但这仅适用于 Newsletter.Resource,不适用于 Send.Resource

【问题讨论】:

    标签: c# api email mailjet


    【解决方案1】:

    使用 MailJet PHP 库发送带有回复的电子邮件:

    $mj = new \Mailjet\Client('xxxxxxxxxxx','xxxxxxxxxxx',true,['version' => 'v3.1']);
    $body = [
    'Messages' => [
      [
        'From' => [
          'Email' => "",
          'Name' => ""
        ],
        'To' => [
          [
            'Email' => "", 
            'Name' => ""
          ]
        ],
        'Subject' => "", 
        'TextPart' => "", 
        'HTMLPart' => "", 
        'Headers' => [
          'Reply-To' => ""
        ]                           
      ]
     ]
    ];
    
    $response = $mj->post(Resources::$Email, ['body' => $body]);
    $response->success();
    

    【讨论】:

      【解决方案2】:

      使用 MailJet V3 API:

      MailjetClient client = new MailjetClient("MJ_APIKEY_PUBLIC", "MJ_APIKEY_PRIVATE");
               MailjetRequest request = new MailjetRequest
               {
                  Resource = Send.Resource,
               }
                  .Property(Send.FromEmail, "pilot@mailjet.com")
                  .Property(Send.FromName, "Mailjet Pilot")
                  .Property(Send.Subject, "Your email flight plan!")
                  .Property(Send.TextPart, "Dear passenger, welcome to Mailjet!")
                  .Property(Send.HtmlPart, "<h3>Dear passenger, welcome to Mailjet!</h3>")
                  .Property(Send.Recipients, new JArray {
                      new JObject {
                       {"Email", "passenger@mailjet.com"}
                       }
                      })
                  .Property(Send.Headers, new JObject {
                      {"Reply-To", "copilot@mailjet.com"}
                      });
               MailjetResponse response = await client.PostAsync(request);
      

      使用 Send.Headers,来自此链接:https://dev.mailjet.com/guides/#adding-email-headers-v3 与 V3.1 略有不同:https://dev.mailjet.com/guides/#send-api-v3-to-v3-1

      为了节省人们的时间:如果您收到 200 个成功状态代码但没有电子邮件,请检查您的允许发件人列表。此外,“密件抄送”不适用于“收件人”,“密件抄送”应与“收件人”字段一起使用。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-06-09
        • 2016-05-14
        • 1970-01-01
        • 2019-12-24
        相关资源
        最近更新 更多