如何在Mailjet API中添加“回复电子邮件”标头?还是其他标题?
Google搜索会显示属性ReplyEmail
,但这仅适用于Newsletter.Resource
,不适用于Send.Resource
。
答案 0 :(得分:0)
使用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.Header:https://dev.mailjet.com/guides/#adding-email-headers-v3 与V3.1略有不同:https://dev.mailjet.com/guides/#send-api-v3-to-v3-1
要节省人们的时间:如果您收到200个成功状态代码但没有电子邮件,请检查允许的发件人列表。同样,“密件抄送”不适用于“收件人”,应将“密件抄送”与“收件人”字段一起使用。
答案 1 :(得分:0)
使用 MailJet PHP 库通过 Reply-to 发送电子邮件:
$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();