Skip to content

Instantly share code, notes, and snippets.

@nagiyevelchin
Last active February 12, 2022 15:58
Show Gist options
  • Save nagiyevelchin/15b5e94a62b1e4bce35e26ceaa459356 to your computer and use it in GitHub Desktop.
Save nagiyevelchin/15b5e94a62b1e4bce35e26ceaa459356 to your computer and use it in GitHub Desktop.
PHPMailer Gmail working example PHP
<?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();
@nagiyevelchin
Copy link
Author

Capcha-nı söndürmək lazımdır https://accounts.google.com/b/0/displayunlockcaptcha

Bir də burdan icazə vermək
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment