When ever im sending a mail even to an address like
“dshghdfhdf@sdhdsfhhdfdhf.dhfdfhhdf”
the mail function always returns true…
and since im building a NewsLetter script I need to know
how many was sent and how many failed…
This is the function I use:
function sendHTMLemail($to, $subject, $from, $body) {
if (ereg("(.*)< (.*)>", $from, $regs)) {
$from = '=?iso-8859-8?B?'.base64_encode($regs[1]).'?= < '.$regs[2].'>';
} else {
$from = $from;
}
$headers = "From: $from\\r\
";
$headers .= "MIME-Version: 1.0\\r\
";
$boundary = uniqid("HTMLEMAIL");
$headers .= "Content-Type: multipart/alternative;".
"boundary = $boundary\\r\
\\r\
";
$headers .= "This is a MIME encoded message.\\r\
\\r\
";
$headers .= "--$boundary\\r\
".
"Content-Type: text/plain; iso-8859-8\\r\
".
"Content-Transfer-Encoding: base64\\r\
\\r\
";
$headers .= chunk_split(base64_encode(strip_tags($body)));
$headers .= "--$boundary\\r\
".
"Content-Type: text/html; charset=iso-8859-8\\r\
".
"Content-Transfer-Encoding: base64\\r\
\\r\
";
$headers .= chunk_split(base64_encode($body));
$result = mail($to,'=?iso-8859-8?B?'.base64_encode($subject).'?=',"",$headers);
return $result;
}
p.s
when ever I use this function to send my real mail it sents it with no problem