我首先通过运行在 ubuntu 17.04 上安装了 sendmail sudo apt-get install sendmail
,然后我确保我的机器的主机名被添加到如下/etc/hosts/
所示localhost
:
127.0.0.1 localhost myhostname
然后我跑了sudo sendmailconfig
,对所有问题的回答都是肯定的。我现在正在尝试发送一些邮件。我这样做:
echo "Subject: sendmail test" | sendmail -v [email protected]
Sendmail 打印以下内容:
ole@mki:~$ echo "Subject: sendmail test" | sendmail -v [email protected]
WARNING: local host name (localhost) is not qualified; see cf/README: WHO AM I?
[email protected]... Connecting to [127.0.0.1] via relay...
220 localhost ESMTP Sendmail 8.15.2/8.15.2/Debian-8ubuntu1; Mon, 14 Aug 2017 14:28:56 -0500; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
>>> EHLO localhost
250-localhost Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-EXPN
250-VERB
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
>>> VERB
250 2.0.0 Verbose mode
>>> MAIL From:<ole@localhost> SIZE=23 AUTH=ole@localhost
250 2.1.0 <ole@localhost>... Sender ok
>>> RCPT To:<[email protected]>
>>> DATA
250 2.1.5 <[email protected]>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
我不确定此时我应该做什么。我试着放一个“。” 自己在一条线上并返回但没有任何反应。如果我按ctrl C
我会收到提示,请购买该电子邮件不会出现在我的 gmail 收件箱中。想法?
如果您想直接发送 Internet 电子邮件,则使用现有的 DNS (或)记录制作
hostname --dqdn
(FQDN=Fully Qualified Domain Name)报告名称。确切的过程取决于 Linux 发行版。MX
A
您可以强制 sendmail 使用不同于自动配置的名称,但这不是“最好的方式”恕我直言。