Welcome to WebmasterWorld Guest from 54.162.240.235

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

sendmail - high priority

     
5:51 am on Nov 22, 2006 (gmt 0)

10+ Year Member



Hi guys,

Is it possible to set an email as high priority in PHP's sendmail?
I would like this code below to be high priority in Outlook and Outlook express.

[php]
// send the email to ADMIN
$to ="emailaddresshere";
$subject = "subject goes here";
$from = "From: <emailaddresshere>";

$body = "Hello,\n\n";

mail($to, $subject, $body, $from);

[/php]

10:48 am on Nov 22, 2006 (gmt 0)

10+ Year Member



Hi adammc,
You need to use the fourth parameter (headers) of the mail command to set priorities as part of the message header.

E.g.


// send the email to ADMIN
$to ="emailaddresshere";
$subject = "subject goes here";
$headers = "From: <emailaddresshere>\r\n" .
"X-Priority: 1\r\n" .
"Priority: Urgent\r\n" .
"Importance: high";

$body = "Hello,\n\n";

mail($to, $subject, $body, $headers);

HTH,
JP

10:40 pm on Nov 22, 2006 (gmt 0)

10+ Year Member



Thanks for the heads up :)

Is there any difference between doing this headers like these 2 examples?

[php]
$headers="MIME-Version: 1.0\r\n";
$headers.="Content-type: text/html; charset=iso-8859-1\r\n";
[/php]

[php]
$headers = "MIME-Version: 1.0\r\n" .
"Content-type: text/html; charset=iso-8859-1\r\n" .
[/php]

11:18 pm on Nov 22, 2006 (gmt 0)

5+ Year Member



Those two examples will create the same email headers. The only difference is that the first code sample is easier to read/understand.
11:22 pm on Nov 22, 2006 (gmt 0)

10+ Year Member



Thanks barns101 :)
 

Featured Threads

Hot Threads This Week

Hot Threads This Month