Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require '../phpmailer/class.phpmailer.php';
- $mail = new PHPMailer(true);
- $body .="<table border='1'>";
- $body .="<tr>";
- $body .="<td>No</td>";
- $body .="<td>nama</td>";
- $body .="<td>email</td>";
- $body .="<td>kegiatan</td>";
- $body .="</tr>";
- $i=1;
- $email='';
- while ($row_spc = mysql_fetch_assoc($spc)){
- if($email!=$row_spc['email']){
- $mail = new PHPMailer(true);
- $body .="<tr>";
- $body .="<td>".$i."</td>";
- $body .="<td>".$row_spc['nama']."</td>";
- $body .="<td>".$row_spc['email']."</td>";
- $body .="<td>".$row_spc['kegiatan']."</td>";
- $body .="</tr>";
- if($i!=1){
- $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 = 'xxxxxx@gmail.com'; // SMTP server username
- $mail->Password = 'xxxxxxxx'; // SMTP server password
- //$mail->IsSendmail(); // tell the class to use Sendmail
- $mail->AddReplyTo('xxxxxxxx@gmail.com');
- $mail->From = 'xxxxxxxx@gmail.com';
- $mail->FromName ='xxxxx';
- $to = $row_spc['email'];
- $mail->AddAddress($to);
- $mail->Subject = 'report sales';
- //$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.';
- }
- $email=$row_spc['email'];
- $i++;
- }
- else {
- $body .="<tr>";
- $body .="<td></td>";
- $body .="<td></td>";
- $body .="<td></td>";
- $body .="<td>".$row_spc['kegiatan']."</td>";
- $body .="</tr>";
- }
- }
- $body .="</table>";
- ?>
- </p>
- <p> </p>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement