28

我什么都试过了,我上网阅读测试,我不能收到电子邮件出去:

telnet <IP> 25
EHLO
MAIL FROM: <from-email>
RCPT TO: <recipient-email>
DATA
Type message here.
. <Enter>
=>

我什至试过这个,当我输入句号时,我什么也没得到——但安装了后缀。

4

2 回答 2

52

检查 postfix 是否正在运行

sudo postfix status

如果它没有运行,请启动它。

sudo postfix start

然后 telnet 到 localhost 端口 25 以测试电子邮件 id

ehlo localhost
mail from: root@localhost
rcpt to: your_email_id
data
Subject: My first mail on Postfix

Hi,
Are you there?
regards,
Admin
.

不要忘记 . 在末尾,表示行尾

于 2013-05-06T07:14:58.013 回答
18

(我刚刚开始工作,我的主要问题是我没有真正的互联网主机名,所以回答这个问题以防它对某人有帮助)

您需要使用 HELO 指定主机名。即便如此,你应该得到一个错误,所以 Postfix 可能没有运行。

此外, => 不是命令。这 '。' 在没有任何文本的单行上告诉 Postfix 条目已完成。以下是我使用的条目:

telnet localhost 25
(says connected)
EHLO howdy.com
(returns a bunch of 250 codes)
MAIL FROM: somebody@blah.com
RCPT TO: (use a real email address you want to send to)
DATA (type whatever you want on muliple lines)
. (this on a single line tells Postfix that the DATA is complete)

您应该得到如下响应:

250 2.0.0 正常:排队为 6E414C4643A

电子邮件可能最终会进入垃圾文件夹。如果它没有出现,那么您可能需要在没有真实 Internet 主机名的主机上设置“后缀”。以下是我如何在我的 Ubuntu 机器上完成该步骤的细分:

sudo vim /etc/postfix/main.cf
smtp_generic_maps = hash:/etc/postfix/generic (add this line somewhere)
(edit or create the file 'generic' if it doesn't exist)
sudo vim /etc/postfix/generic
(add these lines, I don't think it matters what names you use, at least to test)
his@localdomain.local             hisaccount@hisisp.example
her@localdomain.local             heraccount@herisp.example
@localdomain.local                hisaccount+local@hisisp.example
then run:
postmap /etc/postfix/generic (this needs to be run whenever you change the 
generic file)

快乐小径

于 2013-04-29T17:46:36.297 回答