Last active
June 14, 2021 12:46
-
-
Save asraraljuhani/92c728432547b6a31f2494730de253bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'PHPMailer/src/PHPMailer.php'; | |
require 'PHPMailer/src/SMTP.php'; | |
$mail = new PHPMailer\PHPMailer\PHPMailer(); | |
$mail->CharSet = 'UTF-8'; | |
$mail->IsSMTP(); // enable SMTP | |
$mail->SMTPDebug = 0; // debugging: 1 = errors and messages, 2 = messages only | |
$mail->SMTPAuth = true; // authentication enabled | |
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail | |
$mail->Host = "smtp.gmail.com"; | |
$mail->Port = 465; // or 587 | |
$mail->IsHTML(true); | |
$mail->Username = "ALMousallauqu@gmail.com"; | |
$mail->Password = ""; | |
$mail->SetFrom("ALMousallauqu@gmail.com"); | |
$mail->Subject = "Test"; | |
$mail->Body = "hello"; | |
$mail->AddAddress("asrar@gmail.com"); | |
if(!$mail->Send()) { | |
echo "Mailer Error: " . $mail->ErrorInfo; | |
} else { | |
echo "Message has been sent"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Download PHPMailer.php and SMTP.php files from here
https://github.com/PHPMailer/PHPMailer