我很难在我的 Aws Ubuntu 服务器上设置 Postfix。我从一个干净的服务器开始,安装了 Sentora 和 Laravel。
1.首先我在 AWS Securty 上打开了 25 端口。
2.比我在 Laravel 中配置的电子邮件:
MAIL_DRIVER=smtp
MAIL_HOST=my-domain.com
MAIL_PORT=25
MAIL_USERNAME=office@my-domain.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=false
3.比在 index.php 中我尝试一个简单的测试:
<?php
// the message
$msg = "First line of text\nSecond line of text";
// use wordwrap() if lines are longer than 70 characters
$msg = wordwrap($msg,70);
// send email
mail("someone@example.com","My subject",$msg);
?>
在收到 5 封测试邮件后,我的收件箱中收到了 2 封邮件(雅虎),原因是:
无法与主机 my-domain .com 建立连接 [连接超时 #110]
如果我通过终端在 POSTFIX 上运行测试,我会得到以下信息:
ubuntu@cpanel:~$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 cpanel.pe-scena.ro ESMTP
ehlo localhost
mail from: office@my-domain.com
rcpt to: vedt@yahoo.com
data
Subject: My first mail on Postfix
Hi,
Are you there?
regards,
Admin
.250-cpanel.my-domain.com
250-PIPELINING
250-SIZE 20480000
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
250 2.1.0 Ok
250 2.1.5 Ok
403 4.5.0 <DATA>: Data command rejected: Improper use of SMTP command pipelining
221 2.7.0 Error: I can break rules, too. Goodbye.
Connection closed by foreign host.