php mailer part 2
| From: | Ross | Date: | Fri, 13 Oct 2006 08:22:26 +0000 |
| Subject: | php mailer part 2 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-243079@lists.php.net to get a copy of this message | ||
Thanks Richard but now.....
This script send out a few hundred email addresses but I do not seem to be
getting any returned to from failed email addresses eg.
myaddress@thisdoesnotttttexist.com
include("mailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->Mailer = "mail";
// telling the class to use SMTP
$mail->IsHTML(true);
$mail->Host = "mail.scottishsocialnetworks.org"; // SMTP server
$mail->FromName = "Scottish Social Networks";
$mail->From = "ross@aztechost.com";
$Sender = "ross@aztechost.com";
//set up the mail loop
$addresses = array();
$addresses = explode(",", $mail_to);
$mail->AddAttachment($userfile, $_FILES['userfile']['name']);
$mail->Subject = $mail_subject;
$mail->Body = nl2br($mail_body);
$mail->WordWrap = 50;
for($i = 0; $i < count($addresses); $i++)
{
$mail->AddAddress($addresses[$i]);
if(!$mail->Send())
{
echo "Message was not sent";
echo "Mailer Error: " . $mail->ErrorInfo;
}
$mail->ClearAddresses();
}
}