我正在尝试使用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, [<IP>]
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
工作。但由于我对这个命令还不熟悉,我需要帮助来解决这个问题。
答案1
Google 已接受您的消息。请检查您的 Gmail 帐户。其中包括您的垃圾邮件文件夹。如果垃圾邮件文件夹不存在,则您需要联系 Google。