I am trying to send NewsLetter to 1500 users using PHPMailer and my SMTP servers.
I have tried sending the mails to 2 BCC emails for test, and it sucessfully sent mails. But before I go ahead and send the mail to 1500 email address, I have few questions.
I am using this code snippet.
<?php
require "../PHPMailer-master/PHPMailerAutoload.php";
$bcc_list = array('emailaddrs1,emailaddress2');
$mail = new PHPMailer();
$body = file_get_contents('contents.html');
$body = eregi_replace("[\]",'',$body);
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.myserver.com"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "smtp.myserver.com"; // sets the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // SMTP account username
$mail->Password = "mypasss"; // SMTP account password
$mail->SetFrom('[email protected]', 'myserver Support');
$mail->AddReplyTo("[email protected]","myserver Support");
$mail->Subject = "Email sent from xampp";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$address = "[email protected]";
$mail->AddAddress($address, "[email protected]");
foreach($bcc_list as $bcc_email){
$mail->AddBCC($bcc_email);
}
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
//insert that emaill address into database for re-emailing.
} else {
echo "Message sent!";
}
1) How can i make , the email show users email address in <To>
field and not my dummy address ?
2) Does it send as 1 email or 1500 emails ? i.e., how can I catch which emails are successfully sent and which arent ( because of some timeout or something goes wrong) so I can send them again, and not have to spam the all others?