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.
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";
}
?>
Tuhin PaulPosted Mar 3, 2023, 11:10 PM
Hello,
Try following the steps:
1. Upload the PHPMailer files to your server. You can upload the files using an FTP client or the file manager in cPanel.
2. Include the PHPMailer autoload file in your PHP script using the path to the PHPMailer files on your server:
Replace /path/to/phpmailer with the actual path to the PHPMailer files on your server.
3. Use the PHPMailer code as you normally would, making sure to update any paths or configurations as needed for your server.
modify your existing code :
Make sure to update the paths and configurations in the code to match your server setup.