docs:programming:php:sending_mail_with_priority_level

You can use the AddCustomHeader method of phpmailer to send mail with high priority:

function sendNotice($msg, $isAlert = false){
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->Host = MAIL_HOST;
    $mail->From = "noreply@azfmc.com";
    $mail->FromName = basename($_SERVER['PHP_SELF']);
    $mail->AddAddress("someone@example.com");
    $mail->Subject = "your subject";
    if( $isAlert ){
        $mail->Subject .= ' [ ALERT! ]';
        $mail->AddCustomHeader("X-Priority: 1");
        $mail->AddCustomHeader("X-MSMail-Priority: High");
    }
    $mail->Body = $msg;
 
    if( !$mail->Send() )
        echo "\nfailed to send mail!";
}
  • docs/programming/php/sending_mail_with_priority_level.txt
  • Last modified: 2009/08/07 11:01
  • by billh