Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'phpmailer/class.phpmailer.php';
- $mail = new PHPMailer(true);
- $i=1;
- $email='';
- while ($row_spc = mysql_fetch_assoc($spc)){
- if($email!=$row_spc['email']){
- $mail = new PHPMailer(true);
- $body = "<html>
- <head>
- </head>
- <body>
- echo '<tr>
- <td>".$i."</td>
- <td>".$row_spc['nama']."</td>
- <td>".$row_spc['email']."</td>
- <td>".$row_spc['kegiatan']."</td>
- </tr>';
- $email=".$row_spc['email'].";
- $i++;
- }
- else {
- echo '<tr>
- <td></td>
- <td></td>
- <td></td>
- <td>".$row_spc['kegiatan']."</td>
- </tr>';
- }
- }
- ?>
- </table>
- </body>
- </html>";
- $mail->IsSMTP(); // tell the class to use SMTP
- $mail->SMTPAuth = true; // enable SMTP authentication
- $mail->SMTPSecure = 'tls';
- $mail->Port = 587; // set the SMTP server port
- $mail->Host = 'smtp.gmail.com'; // SMTP server
- $mail->Username = 'XXXXX@gmail.com'; // SMTP server username
- $mail->Password = 'xxxxxxx'; // SMTP server password
- //$mail->IsSendmail(); // tell the class to use Sendmail
- $mail->AddReplyTo('XXXXX@gmail.com');
- $mail->From = 'XXXXX@gmail.com';
- $mail->FromName ='server';
- $to = $row_spc['email'];
- $mail->AddAddress($to);
- $mail->Subject = 'report sale';
- //$mail->AltBody = βTo view the message, please use an HTML compatible email viewer!β;
- // optional, comment out and test
- //$mail->WordWrap = 80; // set word wrap
- $mail->MsgHTML($body);
- $mail->IsHTML(true); // send as HTML
- $mail->Send();
- echo 'Message has been sent.';
- $i++;
- }
- }
- ?>
- </p>
- <p> </p>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement