Не удается отправить почту? [php + xampp]
В журнале ошибок sendmail я получаю эту ошибку:
13.05.17 22:33:23 : Must issue a STARTTLS command first. x41sm21034997eey.17 - gsmtp<EOL>
13.05.17 23:02:55 : Must issue a STARTTLS command first. m48sm20850393eeh.16 - gsmtp<EOL>
13.05.17 23:08:05 : Must issue a STARTTLS command first. bn53sm21242331eeb.7 - gsmtp<EOL>
13.05.17 23:43:54 : Must issue a STARTTLS command first. x41sm21511836eey.17 - gsmtp<EOL>
13.05.18 00:07:17 : Must issue a STARTTLS command first. w52sm21617356eev.12 - gsmtp<EOL>
13.05.18 03:03:16 : Must issue a STARTTLS command first. e50sm22561955eev.13 - gsmtp<EOL>
13.05.18 20:28:20 : Must issue a STARTTLS command first. d10sm3967825wik.0 - gsmtp<EOL>
13.05.19 05:14:31 : Must issue a STARTTLS command first. dj7sm5901394wib.6 - gsmtp<EOL>
И мой файл sendMail:
[Отправить письмо]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=artemkller@gmail.com
auth_password=hidepass
force_sender=artemkller@gmail.com
Мой код:
mail
(
$email,
'Driptone - Activate your account',
'Hello '.$username.'. you must activate your account before
you can start using your account.
You can activate your account by clicking on the following link:
http://localhost/drip/activate.php?u='.$this->get['user_id'].'&a='.$this->get['generated_code'].'
Thank you,
Driptone.',
'From: noreply@driptone.com'
);
Что не так с этим? Раньше работал, а сейчас нет?
1 ответ
Причина этого заключается в том, что gmail использует защищенные (TLS) серверы для предотвращения спама.
Убедитесь, что в вашей установке PHP есть поддержка SSL (ищите раздел "openssl" в выводе из phpinfo()
).
Вы можете установить следующие настройки в вашем PHP.ini
:
ini_set("SMTP","ssl://smtp.gmail.com");
ini_set("smtp_port","587");
Также вы можете найти свое решение здесь, если выше не поможет вам.