Answer the question
In order to leave comments, you need to log in
Attach generated PDF file (blob) in phpmailer?
Good afternoon!
Using the library for creating a pdf document, I create the pdf itself.
const worker = html2pdf();
worker
.set(opt)
.from(text, "string")
.output("blob")
.then(pdf => {
const formData = new FormData();
formData.append("php", pdf);
// console.log(pdf);
var xhr = new XMLHttpRequest();
xhr.open("POST", "mailer.php");
xhr.send(formData);
});
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'lib/src/Exception.php';
require 'lib/src/PHPMailer.php';
require 'lib/src/SMTP.php';
$email = new PHPMailer();
$email->CharSet = 'UTF-8';
$email->SetFrom('[email protected]', 'Test'); //Name is optional
$email->Subject = 'Договор';
$email->Body = 'Тестируем отправку почты';
$email->AddAddress( '[email protected]' );
return $email->Send();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question