Created
February 12, 2019 10:25
-
-
Save RahulSaini91/87635867bbaf641d78eb6aeaab6c961b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$mail = new PHPMailer(); // create a new object | |
$mail->IsSMTP(); // enable SMTP | |
$mail->SMTPDebug = 1; // 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 = "[email protected]"; | |
$mail->Password = "password"; | |
$mail->SetFrom("[email protected]"); | |
$mail->Subject = "Test"; | |
$mail->Body = "hello"; | |
$mail->AddAddress("[email protected]"); | |
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