Help answer threads with 0 replies.
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, 09: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, 10:11 AM   #2
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
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-07-2005 11:03 PM
apache/php video mime types dtra Linux - Software 0 08-08-2005 06:55 PM
Mime PHP attachment problems. atomicx Programming 1 08-03-2005 01:31 PM
php mail() problem sashhoney Linux - Software 3 09-30-2003 05:06 AM
Perl - MIME/HTML mail Shak Programming 3 03-09-2003 07:43 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:57 PM.

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
Open Source Consulting | Domain Registration