Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include '../koneksi.php';
- include "../classes/class.phpmailer.php";
- $id=mysqli_real_escape_string($koneksi, $_GET['id']);
- $query = mysqli_query($koneksi, "SELECT * FROM mkt_activity JOIN master_mkt ON mkt_activity.ID_MKT = master_mkt.ID_MKT JOIN master_customer ON mkt_activity.ID_CST = master_customer.AccNo JOIN dtl_activity ON mkt_activity.id = dtl_activity.id WHERE mkt_activity.id='$id'");
- // $query1 = mysqli_query($koneksi, "UPDATE mkt_activity SET mail_status = 'send' WHERE id = '$id'");
- if ($query)
- {
- while ($result = mysqli_fetch_array($query))
- {
- $visit = $result['ID_VISIT'];
- $marketing = $result['MKT_NAME'];
- $email = $result['mkt_email'];
- $company = $result['CompanyName'];
- $contact = $result['NAME_CONTACT'];
- $departement = $result['NAME_DEPT'];
- $purpose = $result['PURPOSE'];
- $model= $result['MODEL'];
- $qdline= $result['QUOT_DLINE'];
- $headmail = "Dear Mr. Yasutaka Kajioka <br><br> Today I Visit " . $contact . ", Departement " . $departement . ", " . $company . ", For " . $purpose . " <br><br>Detail Order : <br><br>";
- $footermail = " Detail Visit History, please open <a href= 'http://testsrp.pt-armstrong.co.id/newmodel/tampil_newmodel@@.php?id=" . $id . "'>Detail</a><br><br>Thank You <br> Best Regards <br><br><br>" . $marketing;
- }
- $mail = new PHPMailer;
- $mail->IsSMTP();
- $mail->SMTPSecure = 'ssl';
- $mail->Host = "mail.google.com"; //host masing2 provider email
- $mail->SMTPDebug = 2;
- $mail->Port = 465;
- $mail->SMTPAuth = true;
- $mail->Username = "esales@gmail.com"; //user email
- $mail->Password = "12345678"; //password email
- $mail->SetFrom("noreply@gmail.com","NOREPLY-SRPT"); //set email pengirim
- $mail->Subject = "Visit Report " . $company; //subyek email
- $mail->AddAddress("esales.ptai@gmail.com"); //tujuan email
- $mail->AddBCC("nendies@gmail.com"); //tujuan BCC
- $mail->isHTML(true);//Set email to Format Html
- $mail->Body = $headmail . "<table border=1>
- <tr>
- <th>No</th>
- <th>Part Code</th>
- <th>Part Name</th>
- <th>Model</th>
- <th>Application Model</th>
- <th>Qty / Month</th>
- <th>Life Time</th>
- <th>Sample Plan Date</th>
- <th>Sample Qty</th>
- <th>PreOrder Date</th>
- <th>PreOrder Qty</th>
- <th>Quotation Deadline</th>
- <th>Start Mas Pro</th>
- <th>Remarks</th>
- </tr>";
- $query = mysqli_query($koneksi, "SELECT * FROM dtl_activity LEFT JOIN mkt_activity ON dtl_activity.id = mkt_activity.id JOIN master_mkt ON mkt_activity.ID_MKT = master_mkt.ID_MKT JOIN master_customer ON mkt_activity.ID_CST = master_customer.AccNo WHERE mkt_activity.id='$id'");
- $num=1;
- while ($result = mysqli_fetch_array($query))
- {
- $itemcode=$result['ITEM_CODE'];
- $model=$result['MODEL'];
- $qprod=$result['QTY_PRD'];
- $lifetime=$result['LIFE_TIME'];
- $DRAWING_NAME=mysqli_real_escape_string($koneksi,$_FILES['upload']['name']);
- $description=$result['description'];
- $appl_model=$result['appl_model'];
- $splan_date=$result['splan_date'];
- $splan_qty=$result['splan_qty'];
- $preorder_date=$result['preorder_date'];
- $preorder_qty=$result['preorder_qty'];
- $qdline=$result['QUOT_DLINE'];
- $startmaspro=$result['START_MASPRO'];
- $remarks=$result['REMARKS'];
- $mail->Body .= "
- <tr>
- <td align='right'>" . number_format($num) . "</td>
- <td>" . $itemcode . "</td>
- <td>" . $description . "</td>
- <td>" . $model . "</td>
- <td>" . $appl_model . "</td>
- <td align='right'>" . number_format($qprod) . "</td>
- <td align='right'>" . number_format($lifetime) . "</td>
- <td align='right'>" . $splan_date . "</td>
- <td align='right'>" . number_format($splan_qty) . "</td>
- <td align='right'>" . $preorder_date . "</td>
- <td align='right'>" . number_format($preorder_qty) . "</td>
- <td align='right'>" . $qdline . "</td>
- <td align='right'>" . $startmaspro . "</td>
- <td>" . $remarks . "</td>
- </tr>";
- $num++;
- }
- $mail->Body .= "</table><br><br>" . $footermail ;
- if($mail->Send())
- echo "Message has been sent ";
- else echo "Failed to sending message";
- echo
- "<script>alert('Success'),window.open('tampil_newmodel@.php?id=".$id."','_SELF')</script>";
- }
- else
- {
- echo
- "
- <script>alert('Maaf Gagal Email'),window.open('detail_newmodel.php?id=".$id."','_SELF')</script>
- ";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement