Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

PHP application sending out many emails

$
0
0

I have been working on an application where I need to send a zip file to my registered users. I'm not worried about speed to get the emails out, I just need to be sure I can send out the files to everyone. I am using phpmailer right now and it works for about 7 minutes, sends out 40 emails and than I get a 500 error and it quits, I am using an SMTP relay server my company uses and its not working out. Anyone have suggestions on a better way of getting this done?

 

Here is a snippet of code:

$mail = new PHPMailer();

                $mail->IsSMTP(); // telling the class to use SMTP
		$phpMailer->SMTPKeepAlive = true;
                $mail->Host       = "relay.appriver.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       = "relay.appriver.com"; // sets the SMTP server
                $mail->Port       = 2525;                    // set the SMTP port for the GMAIL server
                $mail->Username   = "username"; // SMTP account username
                $mail->Password   = "password";        // SMTP account password

$mail->From = "donotreply@domain.com" ;
$mail->FromName = "ReEntry Website";
$mail->AddAddress("someone@domain.com");

$mail->WordWrap = 50;                                 // set word wrap to 50 characters
$mail->AddAttachment("../Placards/placards.zip");         // add attachments
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg");    // optional name
$mail->IsHTML(true);                                  // set email format to HTML

$mail->Subject = 'ReEntry Request ';
$mail->Body    = "Parish Placards";
$mail->AltBody = "Parish Placards";

if(!$mail->Send())
{
   echo "Message could not be sent. <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}else{
$stringData = "<p align=\"left\">Placards have been sent to " . $email . "</p>";
fwrite($fh, $stringData);
}

Viewing all articles
Browse latest Browse all 13200

Trending Articles