Advertisement
Guest User

PHPMailer ERror

a guest
Jan 29th, 2017
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.31 KB | None | 0 0
  1. require_once('/./mailer/PHPMailerAutoload.php');
  2.             $mail = new PHPMailer(true);
  3.             $mail->IsSMTP();
  4.             $mail->SMTPDebug = 0;
  5.             $mail->SMTPAuth  = true;
  6.             $mail->Host = "smtp.gmail.com";
  7.             $mail->From = 'testing@gmail.com';
  8.             $mail->Port  =  587;
  9.             $mail->SMTPOptions = array(
  10.                 'ssl' => array(
  11.                     'verify_peer' => false,
  12.                     'verify_peer_name' => false,
  13.                     'allow_self_signed' => true
  14.                 )
  15.             );
  16.             $mail->isHTML(true);
  17.             $mail->AddStringAttachment($dompdf->output(), $last_id_invoice.'.pdf');
  18.             $mail->AddAddress($this->input->post('email'));
  19.             $mail->Username = "testing@gmail.com";
  20.             $mail->Password = "passwordgmail";
  21.             $mail->SetFrom('testing@gmail.com', 'WebCom');
  22.             $mail->AddReplyTo('testing@gmail.com', 'WebCom');
  23.             $mail->Subject = "tiket";
  24.             $html = "
  25.             <html>
  26.             <head>
  27.             <style>
  28.                 table, td, th {    
  29.                     border: 1px solid #ddd;
  30.                     text-align: left;
  31.                 }
  32.  
  33.                 table {
  34.                     border-collapse: collapse;
  35.                     width: 100%;
  36.                 }
  37.  
  38.                 th, td {
  39.                     padding: 15px;
  40.             </style>
  41.             </head>
  42.             <body>
  43.                 <table rules=\"all\" style=\"border-color: #ddd;\" cellpadding=\"8\">
  44.                     <thead>
  45.                         <tr>
  46.                               <th>Qty</th>
  47.                               <th>Product</th>
  48.                               <th>Serial #</th>
  49.                               <th>Description</th>
  50.                               <th>Subtotal</th>
  51.                         </tr>
  52.                     </thead>
  53.                     <tbody>
  54.             ";
  55.                         $total_harga = 0;
  56.                         if (!empty($data_pembelian)) {
  57.                            
  58.                             foreach ($data_pembelian as $result_pembelian) :
  59.                    
  60.                         $html .= "<tr>";
  61.                         $html .=  " <td>".$result_pembelian->qty_tiket."</td>";
  62.                         $html .= "<td>".$result_pembelian->nama_tiket."</td>";
  63.                         $html .=   "<td>".$last_id_customer."-".$last_id_invoice."</td>";
  64.                         $html .=   "<td>Tousled lomo letterpress</td>";
  65.                         $html .=   "<td>Rp. ".$this->cart->format_number($result_pembelian->sub_total_harga)."</td>";
  66.                         $html .= "</tr>";
  67.                          endforeach; }
  68.                         $total_harga += $result_pembelian->sub_total_harga;
  69.             $html .= "
  70.                     </tbody>
  71.                 </table>
  72.             </body>
  73.             </html>
  74.             ";
  75.             $mail->Body = $html;
  76.             if(!$mail->Send())
  77.             {
  78.                echo "Message could not be sent. <p>";
  79.                echo "Mailer Error: " . $mail->ErrorInfo;
  80.               // exit;
  81.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement