Невозможно отправить электронное письмо от localhost - PullRequest
0 голосов
/ 09 июня 2018

Я изменил php.ini и sendmail.ini следующим образом:

[php.ini]

extension=php_openssl.dll
[mail function]
SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = [mymail]@gmail.com
sendmail_path = "\"E:\xampp\sendmail\sendmail.exe" -t"

[sendmail.ini]

smtp_server= smtp.gmail.com
smtp_port=587
smtp_ssl=auto
error_logfile=error.log
debug_logfile=debug.log
auth_username= [mymail]@gmail.com
auth_password= [mymailpassword]
pop3_server=
pop3_username=
pop3_password=
force_sender=[mymail]@gmail.com
force_recipient=
hostname=localhost

html-код

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <form method="post">
        <input type="email" name="email"> 
        <input type="submit" name="submit">
    </form>
</body>
</html>

php-код

if (isset($_POST['submit'])) {
    if (mail($_POST['email'], 'subject', 'Message')) {
        echo 'Success';
    } else {
        echo 'Failed';
    }
}

Когда я нажимаюКнопка отправки показывает сообщение «Успех», но не отправляет электронное письмо.Пожалуйста, предложите.

...