Last active
February 12, 2022 15:58
-
-
Save nagiyevelchin/15b5e94a62b1e4bce35e26ceaa459356 to your computer and use it in GitHub Desktop.
PHPMailer Gmail working example PHP
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
<?php | |
/** | |
* PHPMailer Gmail working example | |
* | |
* composer require phpmailer/phpmailer | |
* | |
*/ | |
require 'autoload.php'; | |
use PHPMailer\PHPMailer\PHPMailer; | |
$mail = new PHPMailer(true); | |
//$mail->SMTPDebug = 3; | |
$mail->isSMTP(); | |
$mail->Host = 'smtp.gmail.com'; | |
$mail->Port = 587; | |
$mail->SMTPSecure = 'tls'; | |
$mail->SMTPAuth = true; | |
$mail->Username = '***@gmail.com'; | |
$mail->Password = '***'; | |
$mail->CharSet = PHPMailer::CHARSET_UTF8; | |
$mail->setFrom('***@gmail.com', 'From Name'); | |
$mail->addAddress('[email protected]'); | |
$mail->Subject = '***' | |
$mail->isHTML(true); | |
$mail->Body = 'messageHTML'; | |
$result = $mail->send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Capcha-nı söndürmək lazımdır https://accounts.google.com/b/0/displayunlockcaptcha
Bir də burdan icazə vermək
