Maison > développement back-end > tutoriel php > php-sendmail - PHP sendmail 邮件发送失败,如何调试

php-sendmail - PHP sendmail 邮件发送失败,如何调试

WBOY
Libérer: 2016-06-06 20:29:42
original
1561 Les gens l'ont consulté

环境centos7

<code>yum install sendmail
systemctl enable sendmail
systemctl start sendmail</code>
Copier après la connexion
Copier après la connexion

PHP代码

<code><?php $to = 'coconets@163.com';
$subject = 'test';
$message = 'a';
$s = mail($to,$sujbect,$message);
var_dump($s);
</code></code>
Copier après la connexion
Copier après la connexion

输出的是true,可测试了很多次,都没有收到邮件(163邮箱)。

sendmail 状态

<code>[root@flxx2 web]# systemctl status sendmail
sendmail.service - Sendmail Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/sendmail.service; enabled)
   Active: active (running) since Thu 2015-08-20 08:04:54 CST; 22min ago
  Process: 14364 ExecStart=/usr/sbin/sendmail -bd $SENDMAIL_OPTS $SENDMAIL_OPTARG (code=exited, status=0/SUCCESS)
  Process: 14358 ExecStartPre=/etc/mail/make aliases (code=exited, status=0/SUCCESS)
  Process: 14355 ExecStartPre=/etc/mail/make (code=exited, status=0/SUCCESS)
 Main PID: 14368 (sendmail)
   CGroup: /system.slice/sendmail.service
           └─14368 sendmail: accepting connections

Aug 20 08:08:50 flxx2 sendmail[14399]: t7K08o9M014399: from=<apache>, size=304, class=0, nrcpts=1, msgid=, ctladdr=<apache> (48/48), delay=00:00:03, xdela...vailable
Aug 20 08:08:53 flxx2 sendmail[14401]: t7K08o9M014399: t7K08r9M014401: DSN: Service unavailable
Aug 20 08:08:54 flxx2 sendmail[14401]: t7K08r9M014401: to=root, delay=00:00:01, xdelay=00:00:01, mailer=local, pri=31513, dsn=2.0.0, stat=Sent
Aug 20 08:19:52 flxx2 sendmail[14422]: t7K0JqeO014422: from=<apache>, size=304, class=0, nrcpts=1, msgid=, ctladdr=<apache> (48/48), delay=00:00:03, xdela...vailable
Aug 20 08:19:55 flxx2 sendmail[14424]: t7K0JqeO014422: t7K0JteO014424: DSN: Service unavailable
Aug 20 08:19:55 flxx2 sendmail[14424]: t7K0JteO014424: to=root, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31513, dsn=2.0.0, stat=Sent
Hint: Some lines were ellipsized, use -l to show in full.
[root@flxx2 web]#
</apache></apache></apache></apache></code>
Copier après la connexion
Copier après la connexion

回复内容:

环境centos7

<code>yum install sendmail
systemctl enable sendmail
systemctl start sendmail</code>
Copier après la connexion
Copier après la connexion

PHP代码

<code><?php $to = 'coconets@163.com';
$subject = 'test';
$message = 'a';
$s = mail($to,$sujbect,$message);
var_dump($s);
</code></code>
Copier après la connexion
Copier après la connexion

输出的是true,可测试了很多次,都没有收到邮件(163邮箱)。

sendmail 状态

<code>[root@flxx2 web]# systemctl status sendmail
sendmail.service - Sendmail Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/sendmail.service; enabled)
   Active: active (running) since Thu 2015-08-20 08:04:54 CST; 22min ago
  Process: 14364 ExecStart=/usr/sbin/sendmail -bd $SENDMAIL_OPTS $SENDMAIL_OPTARG (code=exited, status=0/SUCCESS)
  Process: 14358 ExecStartPre=/etc/mail/make aliases (code=exited, status=0/SUCCESS)
  Process: 14355 ExecStartPre=/etc/mail/make (code=exited, status=0/SUCCESS)
 Main PID: 14368 (sendmail)
   CGroup: /system.slice/sendmail.service
           └─14368 sendmail: accepting connections

Aug 20 08:08:50 flxx2 sendmail[14399]: t7K08o9M014399: from=<apache>, size=304, class=0, nrcpts=1, msgid=, ctladdr=<apache> (48/48), delay=00:00:03, xdela...vailable
Aug 20 08:08:53 flxx2 sendmail[14401]: t7K08o9M014399: t7K08r9M014401: DSN: Service unavailable
Aug 20 08:08:54 flxx2 sendmail[14401]: t7K08r9M014401: to=root, delay=00:00:01, xdelay=00:00:01, mailer=local, pri=31513, dsn=2.0.0, stat=Sent
Aug 20 08:19:52 flxx2 sendmail[14422]: t7K0JqeO014422: from=<apache>, size=304, class=0, nrcpts=1, msgid=, ctladdr=<apache> (48/48), delay=00:00:03, xdela...vailable
Aug 20 08:19:55 flxx2 sendmail[14424]: t7K0JqeO014422: t7K0JteO014424: DSN: Service unavailable
Aug 20 08:19:55 flxx2 sendmail[14424]: t7K0JteO014424: to=root, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31513, dsn=2.0.0, stat=Sent
Hint: Some lines were ellipsized, use -l to show in full.
[root@flxx2 web]#
</apache></apache></apache></apache></code>
Copier après la connexion
Copier après la connexion

错误点在:
DSN: Service unavailable

Étiquettes associées:
php
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal