Jump to content

sending multiple emails with phpmailer


xox

Recommended Posts

Hello,

I'm using phpmailer for this job, and what I want is that in first mail user gets only text and in second he gets text with attachment. But code below is only sending me the mail with attachment(second mail), what is cosing this problem?

 

 

Here's the code


for ($i=0; $i<2; $i++)
      {
                  if (!class_exists("phpmailer")) {
                 require("PHPMailer/class.phpmailer.php");  
                 }         
                 if ($price != 0 )
                 {        
                   
                    $mail = new PHPMailer();
                    $mail->CharSet = 'UTF-8';
                    $mail->From = "[email protected]";
                    $mail->FromName = "Company";        
                    $mail->AddAddress($email, "");
                    $mail->WordWrap = 50;
                    $mail->IsHTML(true); 
                    $mail->Subject = "Subjcet";        
                    $mail->Body = $content;  
                 }
                 
                 if ($i == 1 || $price == 0 )
                 {
                     
                    //require("PHPMailer/class.phpmailer.php");           
                    $mail = new PHPMailer();
                    $mail->CharSet = 'UTF-8';
                    $mail->From = "[email protected]";
                    $mail->FromName = "Company";        
                    $mail->AddAddress($email, "");
                    $mail->WordWrap = 50;
                    $mail->IsHTML(true); 
                    $mail->Subject = "Subjcet";  
                    $mail->Addattachment ("file/patch".$fileName, ); // patch and name of an attachment 
                 }
                
  }

Link to comment
https://forums.phpfreaks.com/topic/232098-sending-multiple-emails-with-phpmailer/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.