在phpmailer中设置紧急选项

Mui*_*ter 9 php phpmailer

我怎样才能发送带有phpmailer的邮件,并在MS Outlook中选择紧急设置?

Mic*_*ski 24

这是通过向出站电子邮件添加重要性和优先级标头来完成的.MS Outlook使用自己的特定一个,而大多数其他邮件客户端使用ImportancePriority.通过AddCustomHeader()方法和$Priority属性使用PHPMailer添加它们.

// For most clients expecting the Priority header:
// 1 = High, 2 = Medium, 3 = Low
$yourMessage->Priority = 1;
// MS Outlook custom header
// May set to "Urgent" or "Highest" rather than "High"
$yourMessage->AddCustomHeader("X-MSMail-Priority: High");
// Not sure if Priority will also set the Importance header:
$yourMessage->AddCustomHeader("Importance: High");
Run Code Online (Sandbox Code Playgroud)

请注意,邮件客户端可以自由地不实现/忽略这些标头,因此您无法完全依赖它们.此外,许多垃圾邮件过滤器会将它们用作识别垃圾邮件的红旗.请谨慎使用它们.

官方文件:

PHPMailer属性

PHPMailer方法