Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mysql_select_db($database_ska, $ska);
- $query_spc = "SELECT karyawan. nama, karyawan.email, kar_kegiatan.kegiatan
- FROM karyawan LEFT JOIN kar_kegiatan ON karyawan.nama=kar_kegiatan.nama ORDER BY nama";
- $spc = mysql_query($query_spc, $ska) or die(mysql_error());
- //$row_spc = mysql_fetch_assoc($spc);
- $totalRows_spc = mysql_num_rows($spc);
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Untitled Document</title>
- </head>
- <body>
- <p> </p>
- <p>
- <?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>';
- if($i!=1){
- $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 = 'phpprathama@gmail.com'; // SMTP server username
- $mail->Password = 'prathama0109'; // SMTP server password
- //$mail->IsSendmail(); // tell the class to use Sendmail
- $mail->AddReplyTo('phpprathama@gmail.com');
- $mail->From = 'phpprathama@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.';
- $i++;
- }
- }
- ?>
- </p>
- <p> </p>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement