Guest User

Untitled

a guest
Jan 3rd, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. $html = ob_get_contents();
  2. ob_end_clean();
  3. $html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
  4. //$html = str_replace("�", "Á", $html);
  5.  
  6. require_once 'dompdf/autoload.inc.php';
  7. use DompdfDompdf;
  8. $dompdf = new DOMPDF();
  9. $dompdf->setPaper('A4', 'portrait');
  10. $dompdf->loadHtml($html);
  11.  
  12. ini_set("memory_limit","64M");
  13. $dompdf->render();
  14. $pdf = $dompdf->output();
  15. file_put_contents("facturas/".$facturaid.".pdf", $pdf);
  16. /* ENVIO DE PDF POR CORREO ELECTRÓNICO */
  17. include "plantillaEmail/templatePedido.php";
  18. include "PHPMailer/class.phpmailer.php";
  19. include "PHPMailer/class.smtp.php";
  20.  
  21. $email_user = "usuario@mail.com";
  22. $email_password = "pass";
  23. $the_subject = "Factura " . $facturaid;
  24. $address_to = $usuariosArray['Username'];
  25. $from_name = "Depildiodo";
  26. $phpmailer = new PHPMailer();
  27. // ---------- datos de la cuenta de Gmail -------------------------------
  28. $phpmailer->Username = $email_user;
  29. $phpmailer->Password = $email_password;
  30. //-----------------------------------------------------------------------
  31. // $phpmailer->SMTPDebug = 1;
  32. $phpmailer->CharSet = 'UTF-8';
  33. $phpmailer->SMTPSecure = 'ssl';
  34. $phpmailer->Host = "mail.depildiodo.com"; // GMail
  35. $phpmailer->Port = 465;
  36. $phpmailer->IsSMTP(); // use SMTP
  37. $phpmailer->SMTPAuth = true;
  38. $phpmailer->setFrom($phpmailer->Username,$from_name);
  39. $phpmailer->AddAddress($address_to); // recipients email
  40. $phpmailer->Subject = $the_subject;
  41. $phpmailer->Body = $body;
  42. $phpmailer->AddAttachment("facturas/".$facturaid.".pdf",
  43. $facturaid.".pdf");
  44. $phpmailer->IsHTML(true);
  45. $phpmailer->Send();
  46. $_SESSION['carrito']= array();
  47. if($redireccion != ""){
  48. header('Location: '.$redireccion, true, 301);
  49. }else {
  50. header('Location: index.php', true, 301);
  51. }
Add Comment
Please, Sign In to add comment