如何正确设置后缀服务器?

问题描述

通过本教程https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mariadb-php-lamp-stack-on-debian-10,我已经设置了灯泡虚拟主机(因此,在本地主机上一切正常)。然后要发送电子邮件,我还必须设置一个邮件服务器->

我已经设置了后缀(在教程中),所以我的PHP.ini如下所示:

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

我可以对其进行测试:

$telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 Shepherd.Home ESMTP Postfix (Debian/GNU)
helo [email protected]
250 Shepherd.Home
quit

所以我知道后缀有效。但是,具有以下简单的PHP脚本:

<!DOCTYPE html>
<html>

<body>
    <?PHP
    $to = '[email protected]';
    $sub = 'Test mail';
    $message = 'Hello! this is a simple email message';
    $from = '[email protected]';
    $header = 'From:' . $from;
    if (mail($to,$sub,$message,$header)) {
        echo "Mail Sent.<br>";
    } else {
        echo 'Mail Bad<br>';
    }
    ?>
</body>

</html>

将成功打印"Mail Sent.",但是即使15分钟后,我也没有在[email protected]上收到任何消息。所以发生了什么事?我该如何解决

其他信息: /etc/postfix/main.cf

...
#I have added
relayhost = [smtp.gmail.com]:587

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)