IT Community - Software Programming, Web Development and Technical Support

What are the header contents to be sent in the php mail function...

This is a discussion on What are the header contents to be sent in the php mail function... within the PHP Programming forums, part of the Web Development category; What are the header contents to be sent in the php mail function to differentiate between a text mail and ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > PHP Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-17-2007, 03:46 AM
bluesky bluesky is offline
D-Web Analyst
 
Join Date: Jun 2007
Posts: 201
bluesky is on a distinguished road
Default What are the header contents to be sent in the php mail function...

What are the header contents to be sent in the php mail function to differentiate between a text mail and html mail..!

The Normal mail function in php is the

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

Common Header Part
==================
$headers = "From: Our Company <company@ourcompany.com>\n";
$headers .= "Reply-To: Our Company <company@ourcompany.com>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";


so if we want to send a text mails we need to send the $header content as ..

$message = "--$mime_boundary\n";
$message .= "Content-Type: text/plain; charset=UTF-8\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";

and while in case of sending HTML mails

$message .= "--$mime_boundary\n";
$message .= "Content-Type: text/html; charset=UTF-8\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Help] Script to get contents of a function from other file rajkumar PHP Programming 0 11-15-2007 06:23 AM
HTML format and attachment in the mail function are work in gmail but not in yahoo Vani Sri PHP Programming 0 10-18-2007 02:48 AM
How do I stop spammers using header injection with my PHP Scripts? itbarota PHP Programming 0 09-11-2007 12:11 AM
mail function vijayanand PHP Programming 2 08-03-2007 12:55 AM
Mail header P.Sathiya PHP Programming 1 07-20-2007 07:36 AM


All times are GMT -7. The time now is 02:04 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0