How to Set Email Priority to High or Highest With PHP mail()

Today we were working on a web application that needed to dispatch several emails to users using the PHP mail function. The client requested that these emails have a priority set indicating to customers that they needed to be addressed immediately. If you are unfamiliar with email priority it is usually represented by an exclamation symbol, often red, that displays next to the message in your email client.

At first we weren’t quite sure how to achieve this, however, with some experimentation we put together the following solution that seems to work in all common email clients:

	//BUILD EMAIL HEADERS
	$headers  = "From: Some Person <person@website.com>n";
	$headers .= "Reply-To: person@website.comn";
	$headers .= "Return-Path: person@website.comn";
	$headers .= "MIME-Version: 1.0n";
	$headers .= "Content-Type: text/html; charset="iso-8859-1"n";
	
	//SET EMAIL PRIORITY
	$headers .= "X-Priority: 1 (Highest)n";
	$headers .= "X-MSMail-Priority: Highn";
	$headers .= "Importance: Highn";
	
	//SEND EMAIL
	mail("to@website.com","Subject","Body",$headers);

Ready to start your project?

Scroll to Top