better html emails
This commit is contained in:
parent
6e7fd28762
commit
0b7d47e816
29
mail.php
29
mail.php
@ -18,3 +18,32 @@ function send_mail($an, $betreff, $text, $ok = '', $error = '') {
|
||||
}
|
||||
}
|
||||
|
||||
function send_html_mail($an, $betreff, $text, $ok = '', $error = '') {
|
||||
$boundary = md5($an.$betreff.$text.time());
|
||||
include 'secret.php';
|
||||
$sender = 'noreply@troy-grunt.de';
|
||||
if (isset ( $_sendermail )) {
|
||||
$sender = $_sendermail;
|
||||
}
|
||||
$header = 'From: ' . $sender . "\n";
|
||||
$header .= 'To: ' . $an . "\n";
|
||||
$header .= 'Content-Type:multipart/alternative;boundary='.$boundary . "\n";
|
||||
$header .= 'X-Mailer: PHP/' . phpversion ();
|
||||
$content = "This is multipart message using MIME\n";
|
||||
$content .= "--" . $boundary . "\n";
|
||||
$content .= "Content-type: text/plain;charset=utf-8\n";
|
||||
$content .= 'Content-Transfer-Encoding: 8bit' . "\n\n";
|
||||
$content .= strip_tags($text)."\n\n";
|
||||
$content .= "--" . $boundary . "\n";
|
||||
$content .= "Content-type: text/html;charset=utf-8\n";
|
||||
$content .= "Content-Transfer-Encoding: 8bit". "\n\n";
|
||||
$content .= '<html><body>'.$text.'</body></html>'."\n\n";
|
||||
|
||||
if (mail ( $an, $betreff, $content, $header ) === true) {
|
||||
echo $ok;
|
||||
} else {
|
||||
echo $error;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user