phpMailer blank page when creating multiple instances of the class

blur13th

New Member
I am creating a function to send a notification email to a user using the phpMailer lib.\[code\] public function notify($address,$subject = '',$body = null,$mailer_options = array()) { try { $phpmailer = new PHPMailer($exceptions = true); $phpmailer->CharSet = 'UTF-8'; $phpmailer->IsSMTP(); $phpmailer->SMTPAuth = true; $phpmailer->SMTPKeepAlive = true; //$phpmailer->SMTPDebug = true; $phpmailer->IsHTML(true); $phpmailer->Host = ... $phpmailer->Username = ... $phpmailer->Password = ... $phpmailer->From = ... $phpmailer->FromName =... $phpmailer->AddAddress($address); $phpmailer->Subject = $subject; $phpmailer->Body = $body; $phpmailer->Send(); $phpmailer->ClearAllRecipients();}\[/code\]It works fine if i just send an email or sending multiple emails inside the class.But if do\[code\]for($i=0;$i<3;$++){ $notification = new $Notification(); $notification->notify(...);}\[/code\]It retuns a blank page. No errors, messages, nothing.Before you ask i have display_errors turned on.What can it be?It works fine if i just have one instance of phpmailer like this:\[code\]$phpmailer = new PHPMailer($exceptions = true);(...) for($i=0;$i<3;$i++) { $phpmailer->AddAddress('address'); $phpmailer->Subject = ""; $phpmailer->Body = "sasa"; $phpmailer->Send(); $phpmailer->ClearAllRecipients(); }\[/code\]
 
Back
Top