Answers for "how to send uploaded file as email attachment by php"

PHP
0

how to get attachments to emails php

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

$email = new PHPMailer();
$email->SetFrom('[email protected]', 'Your Name'); //Name is optional
$email->Subject   = 'Message Subject';
$email->Body      = $bodytext;
$email->AddAddress( '[email protected]' );

$file_to_attach = 'PATH_OF_YOUR_FILE_HERE';

$email->AddAttachment( $file_to_attach , 'NameOfFile.pdf' );

return $email->Send();
Posted by: Guest on July-30-2020

Code answers related to "how to send uploaded file as email attachment by php"

Browse Popular Code Answers by Language