Reputation: 1
<?php
function Send_Mail($to,$subject,$body)
{
date_default_timezone_set('Etc/UTC');
require 'class.phpmailer.php';
$from = "[email protected]";
$mail = new PHPMailer();
$mail->IsSMTP(true);
$mail->SMTPAuth = true;
$mail->Mailer = "smtp";
$mail->Host = "tls://smtp.gmail.com";
$mail->Port = 465;
$mail->Username = "";
$mail->Password = "";
$mail->SetFrom($from, 'From Admin');
$mail->AddReplyTo($from,'employee');
$mail->Subject = $subject;
$mail->MsgHTML($body);
$address = $to;
$mail->AddAddress($address, $to);
if(!$mail->Send())
return false;
else
return true;
}
?>
So i have these setting but i don't know what to write in $mail->Username and password. Do i have to write my gmail account and password or something else?
Upvotes: 0
Views: 1231
Reputation: 707
As described here https://github.com/PHPMailer/PHPMailer, you need to set your SMTP account informations for PhpMailer Username and Password.
Gmail is an SMTP, so if you have an account you can set your account credentials as Username and Password.
Upvotes: 1