Forum Moderators: coopster

Message Too Old, No Replies

Multi-Part E-mail Message Error

         

brendan3eb

11:42 am on Jun 28, 2005 (gmt 0)

10+ Year Member



I followed a tutorial and attempted to send a multi-part message out to my members e-mail addresses which are kept in a database, however everyone on the list just receives a blank e-mail with an attachment. If anyone could direct me to the problem with my code, I'd be very happy. Here is my codE:

$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$message = "
This is a multi-part message in MIME format.\n\n
--$mime_boundary \n
Content-Type: text/plain; charset=\"iso-8859-1\"\n
Content-Transfer-Encoding: 7bit\n\n
$textnewsletter
\n\n
This is a multi-part message in MIME format.\n\n
--$mim_boundary \n
Content-Type: text/html; charset=\"iso-8859-1\"\n
Content-Transfer-Encoding: 7bit \n\n
$htmlnewsletter";
mail("$row[email]", $subject, "", "From: Shurtugal <noreply@shurtugal.com>;\n".
"MIME-Version: 1.0\n".
"Content-Type: multipart/alternative; boundary=\"$mime_boundary\"");

Sarah Atkinson

4:42 pm on Jun 28, 2005 (gmt 0)

10+ Year Member



You might try PHPList [tincan.co.uk] for sending out e-mails. Why reinvent the wheel right?
Sarah

jatar_k

5:33 pm on Jun 28, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



mail("$row[email]", $subject, "", "From: Shurtugal <noreply@shurtugal.com>;\n".

ummm,

bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] )

your third param is empty, therefore, no message ;)

brendan3eb

6:44 pm on Jun 28, 2005 (gmt 0)

10+ Year Member



ahh...im such an idiot, I spent so much time looking at the php manual trying to figure out if I'm using invalid syntax or something like that and didn't notice that simple little thing :)

edit: i put the message in, but now I get an attachment with the message appearing as

This is a multi-part message in MIME format.

--==Multipart_Boundary_x1d10f686146a85a8ec8f176c802406e0x

Content-Type: text/plain; charset="iso-8859-1"

Content-Transfer-Encoding: 7bit

test

This is a multi-part message in MIME format.

--

Content-Type: text/html; charset="iso-8859-1"

Content-Transfer-Encoding: 7bit

<b>test</b>

I just changed it so I'm still trying a few things out, but if any of you guys have a clue on what to change let me know :)

[edited by: brendan3eb at 6:50 pm (utc) on June 28, 2005]

jatar_k

6:47 pm on Jun 28, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



that's why we post, sometimes it's just the benefit of an extra pair of eyes that haven't gone cross eyed lookin at the same code for hours (or days) ;)