我正在尝试使用sendmail
命令从ubuntu服务器发送电子邮件。
我运行了命令echo "Subject: Sendmail test" | sendmail -v <My_Id>
,该命令运行时没有任何错误,但仍然没有收到任何电子邮件。
<My_Id> ... Connecting to [127.0.0.1] via relay...
220 ip-<server-IP>-<region>.compute.internal ESMTP Sendmail 8.14.4/8.14.4/Debian-4.1ubuntu1.1; Wed, 29 May 2019 14:08:42 GMT; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
>>> EHLO ip-<server-IP>-<region>.compute.internal
250-<server-IP>-<region>.compute.internal 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:<ubuntu@ip-<server-IP>-<region>.compute.internal> SIZE=23 AUTH=ubuntu@ip-<server-IP>-<region>.compute.internal
250 2.1.0 <ubuntu@ip-<server-IP>-<region>.compute.internal>... Sender ok
>>> RCPT To:<My_Id>
>>> DATA
250 2.1.5 <My_Id>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
050 <My_Id>... Connecting to gmail-smtp-in.l.google.com. via esmtp...
050 220 mx.google.com ESMTP q73si7270078pjq.89 - gsmtp
050 >>> EHLO ip-<server-IP>-<region>.compute.internal
050 250-mx.google.com at your service, [35.162.25.90]
050 250-SIZE 157286400
050 250-8BITMIME
050 250-STARTTLS
050 250-ENHANCEDSTATUSCODES
050 250-PIPELINING
050 250-CHUNKING
050 250 SMTPUTF8
050 >>> STARTTLS
050 220 2.0.0 Ready to start TLS
050 >>> EHLO ip-<server-IP>-<region>.compute.internal
050 250-mx.google.com at your service, [<Server_Public_IP>]
050 250-SIZE 157286400
050 250-8BITMIME
050 250-ENHANCEDSTATUSCODES
050 250-PIPELINING
050 250-CHUNKING
050 250 SMTPUTF8
050 >>> MAIL From:<ubuntu@ip-<server-IP>-<region>.compute.internal> SIZE=398
050 250 2.1.0 OK q73si7270078pjq.89 - gsmtp
050 >>> RCPT To:<My_IP>
050 >>> DATA
050 250 2.1.5 OK q73si7270078pjq.89 - gsmtp
050 354 Go ahead q73si7270078pjq.89 - gsmtp
050 >>> .
050 250 2.0.0 OK 1559138663 q73si7270078pjq.89 - gsmtp
050 <My_IP>... Sent (OK 1559138663 q73si7270078pjq.89 - gsmtp)
250 2.0.0 x4TE8g85010394 Message accepted for delivery
My_IP... Sent (x4TE8g85010394 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
我还检查了服务器是否能够连接到Google SMTP框telnet gmail-smtp-in.l.google.com 25
,它也可以正常工作:
Trying <IP>...
Connected to gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP m24si25196886pgj.127 - gsmtp
此外,当我使用mailq
检查邮件队列时,它什么也没显示:
MSP Queue status...
/var/spool/mqueue-client is empty
Total requests: 0
MTA Queue status...
/var/spool/mqueue is empty
Total requests: 0
我知道sendmail
的配置错误。
但是,由于我是该命令的新手,因此在解决此问题时需要帮助。