I am using phpmailer to send email. It gives me an error. Here is the code
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->AddAddress($email);
$mail->Username="ajaynewnew@gmail.com";
$mail->Password="mypassword";
$mail->SetFrom('user@gmail.com','name');
$mail->AddReplyTo("user95@gmail.com"," name");
$mail->Subject = $subject;
$mail->MsgHTML($message);
$mail->Send();
try with this code
$mail = new PHPMailer(true);
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->SMTPAuth = true;
$mail->Host = "ssl://smtp.gmail.com";
$mail->Port = 465;
$mail->AddAddress($email);
$mail->Username="ajaynewnew@gmail.com";
$mail->Password="mypassword";
$mail->SetFrom('user@gmail.com','name');
$mail->AddReplyTo("user95@gmail.com"," name");
$mail->Subject = $subject;
$mail->MsgHTML($message);
$mail->Send();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.