homepage Welcome to WebmasterWorld Guest from 54.227.67.210
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
sendmail - high priority
adammc




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

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]

 

jpjones




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

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

adammc




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

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]

barns101




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

Those two examples will create the same email headers. The only difference is that the first code sample is easier to read/understand.

adammc




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

Thanks barns101 :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved