PHP gevorderde |
|
Probeer deze functie eens om je (html)email mee te verzenden:
function sendHTMLEmail($name, $email, $plainmessage, $htmlmessage, $subject, $recipient) {
$mime_boundary = 'Rienvanhulten.nl_' . md5(time());
$headers = "From: " . $name . " <" . $email . ">\r\n";
$headers .= "Reply-to: " . $email . "\r\n";
$headers .= "Return-Path: " . $email . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/alternative; boundary=\"" . $mime_boundary .
"\";\r\n\r\n";
$message = "--" . $mime_boundary . "\r\n";
$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
$message .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$message .= $plainmessage . "\r\n\r\n";
$message .= "--" . $mime_boundary . "\r\n";
$message .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n";
$message .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$message .= "<html>\n<head>\n<style type=\"text/css\">\nbody\n{\nfont:11px \"Trebuchet MS\", Arial, Verdana;\n}\n</style>\n</head>\n<body>\n" . $htmlmessage . "\n</body>\n</html>\r\n\r\n";
$message .= "--" . $mime_boundary . "--\r\n\r\n\r\n";
return mail($recipient, $subject, $message, $headers);
}
function sendHTMLEmail($name, $email, $plainmessage, $htmlmessage, $subject, $recipient) { $mime_boundary = 'Rienvanhulten.nl_' . md5(time()); $headers = "From: " . $name . " <" . $email . ">\r\n"; $headers .= "Reply-to: " . $email . "\r\n"; $headers .= "Return-Path: " . $email . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: multipart/alternative; boundary=\"" . $mime_boundary . "\";\r\n\r\n"; $message = "--" . $mime_boundary . "\r\n"; $message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n"; $message .= "Content-Transfer-Encoding: 8bit\r\n\r\n"; $message .= $plainmessage . "\r\n\r\n"; $message .= "--" . $mime_boundary . "\r\n"; $message .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n"; $message .= "Content-Transfer-Encoding: 8bit\r\n\r\n"; $message .= "<html>\n<head>\n<style type=\"text/css\">\nbody\n{\nfont:11px \"Trebuchet MS\", Arial, Verdana;\n}\n</style>\n</head>\n<body>\n" . $htmlmessage . "\n</body>\n</html>\r\n\r\n"; $message .= "--" . $mime_boundary . "--\r\n\r\n\r\n"; return mail($recipient, $subject, $message, $headers); }
|