require("phpmailer.inc.php"); class sendmail { public static function sendAccountActivateMail($to,$subject,&message) { $flg = false; try { $mail= new PHPMailer(); $mail->IsSMTP(); $mail->SMTPAuth= true; $mail->SMTPSecure= "tls"; $mail->Host= "smtp.gmail.com"; $mail->Port= 587; $mail->Username= "xxx@mydomain.com"; $mail->Password= "xxxxxx"; $mail->AddReplyTo("info@mydomain.com"); $mail->From= "info@mydomain.com"; $mail->FromName= "Website"; $mail->Subject= $subject; $mail->WordWrap= 50; $mail->Body = $message; $mail->AddAddress($to); $mail->Send(); } catch(Exception $e) { $flg = false; } return $flg; } }
Trying to send mail through phpmailer with smtp. turning on debug gives me error:
SMTP -> ERROR: RCPT not accepted from server: 550 SMTP AUTH is required for message submission on port 587 SMTP -> ERROR: DATA command not accepted from server: SMTP -> NOTICE: EOF caught while checking if connected