php отправлять почту с localhost

Я новичок в php. Я пытался отправить почту с php, используя этот код.

<?php

    $to      = '[email protected]';
    $subject = 'The subject';
    $message = 'hello';
    $headers = 'From: [email protected]' . "\r\n" .
        'Reply-To: [email protected]' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();

    mail($to, $subject, $message, $headers);

?>

У меня есть изменения настроек в php.ini

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = [email protected]

& в sendmail.ini

# A freemail service example
account Gmail
tls on
tls_certcheck off
host smtp.gmail.com
from [email protected]
auth on
user [email protected]
password xxxxxxxxx

# Set a default account
account default : Gmail

Теперь код работает успешно, но я не получаю почту.

Ответы на вопрос(7)

Ваш ответ на вопрос