You are here: Re: mail does not get sent... « All PHP « IT news, forums, messages
Re: mail does not get sent...

Posted by Gernot Frisch on 12/13/06 13:18

Complete example that *should* work, but does not.
It used to work, but now it does not anymore... _sigh_


<?php
$mail_to = xy@mydomain.com; // address exists
$mail_from = "xy@mydomain.com";
//add From: header
$headers = "From: ${mail_from}\r\n";

//specify MIME version 1.0
$headers .= "MIME-Version: 1.0\r\n";
// might need unique id
$headers .= "Message-ID: <".md5(time)."@mydomain.com>\r\n";

//unique boundary
$boundary = '--==Multipart_Boundary_x'.md5(time()).'x';

//tell e-mail client this e-mail contains//alternate versions
$headers .= "Content-Type: multipart/mixed; boundary =
\"$boundary\"\r\n\r\n";

//plain text version of message
$body = "--$boundary\r\n" .
"Content-Type: text/plain; charset=ISO-8859-1\r\n" .
"Content-Transfer-Encoding: base64\r\n\r\n";
$body .= chunk_split(base64_encode("This is the plain text
version!"));

//HTML version of message
$body .= "--$boundary\r\n" .
"Content-Type: text/html; charset=ISO-8859-1\r\n" .
"Content-Transfer-Encoding: base64\r\n\r\n";
$body .= chunk_split(base64_encode("This the <b>HTML</b>
version!"));

// Finish?
$body .= $boundary.'--';

//send message
echo "sending mail: <br>";
echo mail($mail_to, "An HTML Message", $body, $headers);
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация