Hi Team
I sincerely need something important right, i have downloaded using composer require phpmailer/phpmailer on my command prompt. Now i want to use these files on external server(c-panel) and have them on this directory under this code below. Question will i still accomplished to send email with attachment pdf? Need some steps perhaps in terms of following them to accomplished without any issue.
<?php
$mailto = $_POST['mail_to'];
$mailSub = $_POST['mail_sub'];
$mailMsg = $_POST['mail_msg'];
require 'lib/vendor/phpmailer/phpmailer';
$mail = new PHPMailer();
$mail ->IsSmtp();
$mail ->SMTPDebug = 0;
$mail ->SMTPAuth = true;
$mail ->SMTPSecure = 'ssl';
$mail ->Host = "smtp.gmail.com";
$mail ->Port = 465; // or 587
$mail ->IsHTML(true);
$mail ->Username = "[email protected]";
$mail ->Password = "accountsamplepassword";
$mail ->SetFrom("[email protected]");
$mail ->Subject = $mailSub;
$mail ->Body = $mailMsg;
$mail ->AddAddress($mailto);
$mail->AddAttachment('pdf_files/reservation.pdf', 'reservation.pdf');
if(!$mail->Send())
{
echo "Mail Not Sent";
}
else
{
echo "Mail Sent";
}
?>