Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require_once('/./mailer/PHPMailerAutoload.php');
- $mail = new PHPMailer(true);
- $mail->IsSMTP();
- $mail->SMTPDebug = 0;
- $mail->SMTPAuth = true;
- $mail->Host = "smtp.gmail.com";
- $mail->From = 'testing@gmail.com';
- $mail->Port = 587;
- $mail->SMTPOptions = array(
- 'ssl' => array(
- 'verify_peer' => false,
- 'verify_peer_name' => false,
- 'allow_self_signed' => true
- )
- );
- $mail->isHTML(true);
- $mail->AddStringAttachment($dompdf->output(), $last_id_invoice.'.pdf');
- $mail->AddAddress($this->input->post('email'));
- $mail->Username = "testing@gmail.com";
- $mail->Password = "passwordgmail";
- $mail->SetFrom('testing@gmail.com', 'WebCom');
- $mail->AddReplyTo('testing@gmail.com', 'WebCom');
- $mail->Subject = "tiket";
- $html = "
- <html>
- <head>
- <style>
- table, td, th {
- border: 1px solid #ddd;
- text-align: left;
- }
- table {
- border-collapse: collapse;
- width: 100%;
- }
- th, td {
- padding: 15px;
- </style>
- </head>
- <body>
- <table rules=\"all\" style=\"border-color: #ddd;\" cellpadding=\"8\">
- <thead>
- <tr>
- <th>Qty</th>
- <th>Product</th>
- <th>Serial #</th>
- <th>Description</th>
- <th>Subtotal</th>
- </tr>
- </thead>
- <tbody>
- ";
- $total_harga = 0;
- if (!empty($data_pembelian)) {
- foreach ($data_pembelian as $result_pembelian) :
- $html .= "<tr>";
- $html .= " <td>".$result_pembelian->qty_tiket."</td>";
- $html .= "<td>".$result_pembelian->nama_tiket."</td>";
- $html .= "<td>".$last_id_customer."-".$last_id_invoice."</td>";
- $html .= "<td>Tousled lomo letterpress</td>";
- $html .= "<td>Rp. ".$this->cart->format_number($result_pembelian->sub_total_harga)."</td>";
- $html .= "</tr>";
- endforeach; }
- $total_harga += $result_pembelian->sub_total_harga;
- $html .= "
- </tbody>
- </table>
- </body>
- </html>
- ";
- $mail->Body = $html;
- if(!$mail->Send())
- {
- echo "Message could not be sent. <p>";
- echo "Mailer Error: " . $mail->ErrorInfo;
- // exit;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement