PHP mailer phpmail() script

For google

<?php

use PHPMailer\PHPMailer\PHPMailer;

require ‘mailer/vendor/autoload.php’;

//PHPMailer Object
$mail = new PHPMailer;

try {
$mail->SMTPDebug = 2;;
$mail->isSMTP();
$mail->Host = ‘smtp.gmail.com’;
$mail->SMTPAuth = true;
$mail->Username = ‘[email protected]’;
$mail->Password = ‘[email protected]’;
$mail->SMTPSecure = ‘ssl’;
$mail->Port = 465;

$mail->setFrom(‘[email protected]’, ‘Name’);
$mail->addAddress(‘[email protected]’);


$mail->isHTML(true);
$mail->Subject = ‘Subject’;
$mail->Body = ‘HTML message body in <b>bold</b> ‘;
$mail->AltBody = ‘Body in plain text for non-HTML mail clients’;
$mail->send();

} catch (Exception $e) {
echo “Message could not be sent. Mailer Error: {$mail->ErrorInfo}”;
}

 

?>

Leave a Comment

Your email address will not be published. Required fields are marked *

Hire a server Expert to resolve the issue Now.

Hire a server Expert to resolve the issue Now.

Resolve this issue in just 5$ from https://serverexpert.io

 

You have Successfully Subscribed!

Open chat