Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-09-2006, 10:36 AM   #1
Registered: Nov 2005
Location: India
Distribution: Slackware
Posts: 51

Rep: Reputation: 15
Problem with basic PHP MIME mail

Hi there

I've written a very simple PHP mime mail script. I am checking its output in Mozilla mail. The mail shows (To, From and Subject) properly. But to my surprise, the body of the mail is completely empty. What is the reason for that. I've tried it many times but it is not working.
Please help me if you have the experience with it.

$subject="form submitted using custom script";

$boundary = "------------" . md5(uniqid(time()));
$headers="From: root@localhost\r\n";
$headers.="MIME-Version: 1.0\r\n";
$headers.="Content-Type: multipart/mixed;"." boundary=\"".$boundary."\"\r\n";
$headers.="X-Mailer: PHP/" . phpversion();
//$headers.="Content-Transfer-Encoding: 7bit"."\r\n";

$message="This is multipart message in mime format.\n";
$message.="Content-Type: text/html; charset=ISO-8859-1\r\n";
$message.="Content-Transfer-Encoding: 7bit\r\n";
$message.="<html><head></head><body>Hello World</body></html>";

Old 02-09-2006, 11:11 AM   #2
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
I think you need a blank line between the last header line and the first line of the body of the message. Some readers are tolerant of this when missing, others are not.

--- rod.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
php mail problem czarherr Programming 4 09-08-2005 12:03 AM
apache/php video mime types dtra Linux - Software 0 08-08-2005 07:55 PM
Mime PHP attachment problems. atomicx Programming 1 08-03-2005 02:31 PM
php mail() problem sashhoney Linux - Software 3 09-30-2003 06:06 AM
Perl - MIME/HTML mail Shak Programming 3 03-09-2003 08:43 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:28 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration