如何在Mailjet API中添加“回复邮件”头部信息?或者其他头部信息?
通过谷歌搜索,我们发现属性ReplyEmail
只适用于Newsletter.Resource
而不是Send.Resource
。
使用 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);
$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();