hi,
Ich muss mal schauen... War da nicht neulich sogar ein Post mit einem Template, das gegen Fußpilz hilft? ;-)
Fußpilz ist out. Hier ist der Nagelpilz:
Oifache Süntachs;
<?php
$hunt = array(
'from' => 'otto@example.org',
'to' => 'hans@example.org',
'mesg' => "Hallö, mich gähts gu un dich auch hä? Grüße Dir!!",
);
try{
$template = include 'Mailer.php';
$mailer = new Mailer($template, $hunt);
$mailer->senden();
echo "Mail is raus!";
}
catch(Exception $e){
echo $e;
}
?>
Noch oifacheres Klass;
<?php
class Mailer{
private $MTA = '/usr/sbin/sendmail -t';
function __construct($template, $hunt){
$requires = array('from','to','mesg');
foreach($requires as $required_field){
if(! isset($hunt[$required_field])){
throw new Exception("Required: '$required_field' is missing!");
}
}
$hunt['mesg'] = base64_encode($hunt['mesg']);
$values = array_combine($requires, $hunt);
$this->MAILFILE = vsprintf($template, $values);
}
public function senden(){
if(! $pipe = popen($this->MTA, 'w')){
throw new Exception("MTA '$this->MTA' is not available");
}
fputs($pipe, $this->MAILFILE);
fclose($pipe);
}
}
/* ~~~~~~~~~ Mail Template ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
return <<<'DATA'
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset=UTF-8
From: %s
To: %s
Subject: Feedback
%s
DATA;
Horst Pfifferling