use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
$mail = new PHPMailer();
$mail->isSMTP();
$mail->isHTML(true);
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
$mail->SMTPAuth = true;
$mail->Host = $_ENV["EMAIL_HOST"];
$mail->Username = $_ENV["EMAIL_USERNAME"];
$mail->Password = $_ENV["EMAIL_PASSWORD"];
$mail->Port = $_ENV["EMAIL_PORT"];
$mail->setFrom($_ENV["EMAIL_FROM_MAIL"], $_ENV["EMAIL_FROM_NAME"]);
$mail->addAddress("joe@example.net");
$mail->Subject = "Here is the subject";
$mail->Body = "This is the message";
$mail->addAttachment("/tmp/image.jpg");
$mail->send();
composer require phpoffice/phpspreadsheet
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
$spreadsheet = new Spreadsheet();
$activeWorksheet = $spreadsheet->getActiveSheet();
$activeWorksheet->setCellValue('A1', 'Hello World !');
$writer = new Xlsx($spreadsheet);
$writer->save('hello world.xlsx');