Will be revised / merged / structured
Instead of "fiddling around" with a Fake Sendmail (in order to get the poor PHP API mail() Function working), i definately recommend the usage of the Phpmailer Class instead: http://sourceforge.net/projects/phpmailer/
It is easy to use, and (as a nice side effect) it does not only deliver emails quickly and easily, it also supports multipart mime emails (embedded grafics etc.) including HTML emails.
You may use this mailX() function (instead of mail()) as an easy kick-off. There is no Fake Sendmail required:
- Code: Select all
<?php
include("class.phpmailer.php");
include("class.smtp.php");
function mailX($to, $subject, $message, $from) {
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.yoursmtp.de"; /* your smtp server etc. */
$mail->Port = 587; /* SMTP Port */
$mail->Username = "youruserid"; /* SMTP UserID */
$mail->Password = "yourpasswd"; /* SMTP Password */
$mail->AddAddress($to, '');
$mail->Subject = $subject;
$mail->Body = $message;
$mail->From = $from; /* replace optional by default email */
$fromname = ''; /* replace optional by any name */
$mail->FromName = $fromname;
$mail->AddReplyTo($from,$fromname);
$res = $mail->Send();
if(!$res) {
echo "Mailer Error: " . $mail->ErrorInfo;
}
return $res;
}
?>