21
Den brauche ich nicht zu ersetzen, der ist schon drin, der untere Abschnitt.
<?php
$to = 'webmaster@example.com';
if (mail($to, 'Test', 'Dies ist ein Test')) {
echo 'OK!';
} else {
echo 'Nicht OK!';
}
?>
<?php
$to = 'webmaster@example.com';
define('E_ADIMTO', $to);
define('E_ADIMFROM', $to);
$e_envelope = $to;
$mailenabled = 1;
$test = '';
function fmail($message, $subject = 'Forennachricht', $e_to = E_ADMINTO, $e_from = E_ADMINFROM, & $test)
{
global $mailenabled, $e_envelope;
$b_return = false;
if ($mailenabled == 1) {
if (function_exists('mb_encode_mimeheader')) {
$test .= '1,';
mb_internal_encoding('UTF-8');
$subject = mb_encode_mimeheader($subject, 'UTF-8');
}
$message2 = wordwraputf8($message . ' mit ö', 70, $test);
$pars = null;
if ($e_envelope) {
$test .= '3,';
$pars = '-f' . $e_envelope;
}
if (mail($e_to, $subject, $message2, 'From: ' . $e_from . "\r\n" . 'Content-Type: text/plain; charset=utf-8', $pars)) {
$test .= '4,';
return;
}
if (mail($e_to, $subject, $message2, 'From: ' . $e_from . "\r\n" . 'Content-Type: text/plain; charset=utf-8')) {
$test .= '5,';
return;
}
if (mail($e_to, $subject, $message, 'From: ' . $e_from . "\r\n" . 'Content-Type: text/plain; charset=utf-8')) {
$test .= '6,';
return;
}
if (mail($e_to, $subject, $message, 'From: ' . $e_from)) {
$test .= '7,';
return;
}
if (mail($e_to, $subject, $message)) {
$test .= '8,';
return;
}
}
return $b_return;
}
function wordwraputf8($text, $width = 70, & $test)
{
if (function_exists('mb_strlen')) {
$test .= '2,';
$a_text = explode("\n", $text);
$text = '';
foreach ($a_text as $paragraph) {
$a_paragraph = explode(' ', $paragraph);
$i_plength = 0;
foreach ($a_paragraph as $word) {
$word .= ' ';
$i_wlength = mb_strlen($word, 'utf-8');
$i_plength += $i_wlength;
if ($i_plength >= $width) {
$text .= "\n";
$i_plength = $i_wlength;
}
$text .= $word;
}
$text .= "\n";
}
}
return $text;
}
fmail('Dies ist ein Test', 'Test', $to, $to, $test);
echo $test;
?>
1,2,3,4,
1,2,3,5,
Thema | Autor | Forum | Beiträge | Letzter Beitrag |
---|---|---|---|---|
Changelog 2.0 | Jörg Kruse | Changelogs | 5 | 31.12.2011 17:05 |