я пытаюсь отправить почту через SMTP от gmail
SMTP Mail Server отправка почты не работает
мой PHP код
<?php
$body = 'test body';
$to = "[email protected]";
$from = '[email protected]';
$fName = 'first name';
$lName = 'last name';
$subject = 'my subject';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = 'UTF-8';
// $body = eregi_replace("[\]",'',$body);
$mail->Host = "smtp.gmail.com"; // SMTP server example
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // SMTP account username example
$mail->Password = "password";
$mail->SetFrom($from, $fName.' '.$lName);
$mail->Subject = $subject;
$mail->AddAddress($to, "Support Team");
$mail->MsgHTML($body);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
?>
его дать мне эту ошибку ::
SMTP -> ERROR: Failed to connect to server: Permission denied (13)
SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host.
я не знаю, в чем проблема?
try '$ mail-> SMTPSecure = 'tls';' Вы используете правильные учетные данные для gmail? –
добавлено '$ mail-> SMTPSecure = 'tls';' но не работает –