Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $html = ob_get_contents();
- ob_end_clean();
- $html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
- //$html = str_replace("�", "Á", $html);
- require_once 'dompdf/autoload.inc.php';
- use DompdfDompdf;
- $dompdf = new DOMPDF();
- $dompdf->setPaper('A4', 'portrait');
- $dompdf->loadHtml($html);
- ini_set("memory_limit","64M");
- $dompdf->render();
- $pdf = $dompdf->output();
- file_put_contents("facturas/".$facturaid.".pdf", $pdf);
- /* ENVIO DE PDF POR CORREO ELECTRÓNICO */
- include "plantillaEmail/templatePedido.php";
- include "PHPMailer/class.phpmailer.php";
- include "PHPMailer/class.smtp.php";
- $email_user = "usuario@mail.com";
- $email_password = "pass";
- $the_subject = "Factura " . $facturaid;
- $address_to = $usuariosArray['Username'];
- $from_name = "Depildiodo";
- $phpmailer = new PHPMailer();
- // ---------- datos de la cuenta de Gmail -------------------------------
- $phpmailer->Username = $email_user;
- $phpmailer->Password = $email_password;
- //-----------------------------------------------------------------------
- // $phpmailer->SMTPDebug = 1;
- $phpmailer->CharSet = 'UTF-8';
- $phpmailer->SMTPSecure = 'ssl';
- $phpmailer->Host = "mail.depildiodo.com"; // GMail
- $phpmailer->Port = 465;
- $phpmailer->IsSMTP(); // use SMTP
- $phpmailer->SMTPAuth = true;
- $phpmailer->setFrom($phpmailer->Username,$from_name);
- $phpmailer->AddAddress($address_to); // recipients email
- $phpmailer->Subject = $the_subject;
- $phpmailer->Body = $body;
- $phpmailer->AddAttachment("facturas/".$facturaid.".pdf",
- $facturaid.".pdf");
- $phpmailer->IsHTML(true);
- $phpmailer->Send();
- $_SESSION['carrito']= array();
- if($redireccion != ""){
- header('Location: '.$redireccion, true, 301);
- }else {
- header('Location: index.php', true, 301);
- }
Add Comment
Please, Sign In to add comment