Apache Sendmail不从GCE VM实例发送电子邮件
我已经在我的谷歌云计算引擎上安装了WordPress网站,但我无法发送邮件。于是在网上搜索后发现 通过以下方式安装并配置了最新版本:Apache Sendmail不从GCE VM实例发送电子邮件,apache,google-cloud-platform,debian,google-compute-engine,sendmail,Apache,Google Cloud Platform,Debian,Google Compute Engine,Sendmail,我已经在我的谷歌云计算引擎上安装了WordPress网站,但我无法发送邮件。于是在网上搜索后发现 通过以下方式安装并配置了最新版本: $ sudo apt-get update $ sudo apt-get install sendmail 运行sendemail配置,对所有内容回答“是”: $ sudo sendmailconfig 编辑了127.0.0.1 localhost instance-1行(instance-1是我的谷歌云实例): 重新启动Apache: sudo servic
$ sudo apt-get update
$ sudo apt-get install sendmail
运行sendemail配置,对所有内容回答“是”:
$ sudo sendmailconfig
编辑了127.0.0.1 localhost instance-1
行(instance-1是我的谷歌云实例):
重新启动Apache:
sudo service apache2 restart
当我在终端中运行下面的命令时,什么也不会发生,我也不能再运行命令了。因此,这一过程似乎没有结束
$ sendmail example@email.com
$date | sendmail-v的输出example@email.com
返回:
example@email.com... Connecting to [127.0.0.1] via relay...
220 instance-1.c.myproject.internal ESMTP Sendmail 8.14.4/8.14.4/Debian-8; Wed, 24 Aug 2016 09:42:18 GMT; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
>>> EHLO instance-1.c.myproject.internal
250-instance-1.c.myproject.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-DELIVERBY
250 HELP
>>> VERB
250 2.0.0 Verbose mode
>>> MAIL From:<info@instance-1.c.myproject.internal> SIZE=29
250 2.1.0 <info@instance-1.c.myproject.internal>... Sender ok
>>> RCPT To:<example@email.com>
>>> DATA
250 2.1.5 <example@email.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
您无法从谷歌计算引擎发送邮件,谷歌将在25日阻止所有传出流量
您将必须使用第三方,如。是的,可以从实例发送电子邮件,所有内容都在本文中解释
默认情况下,Compute Engine允许在除端口25之外的所有端口上进行出站连接,端口25因滥用风险而被阻止。所有其他端口都已打开,包括端口587和465。无法直接从GCE虚拟机发送电子邮件。 请查看以下文档:
- 到TCP目标端口25(SMTP)的出口流量
端口587和465可用于SMTP邮件提交()。这意味着您可以使用外部邮件中继(您自己的或第三方)进行经过身份验证的SMTP,并且此服务器处理到端口25上其他邮件系统的传递。例如,您可以使用以下第三方服务:,或。此外,您还可以通过或仅使用转发邮件。您检查过sendmail的日志文件吗?@AndrzejA.Filip检查我问题中my mail.log文件的输出。查看您的日志文件,我会说您运行sendmail的主机无法连接到internet。您可以通过从终端运行以下命令来检查这一点:nc alt4.gmail-smtp-in.l.google.com25@PeterSkarpetis我像你说的那样运行了命令,但是我没有得到任何回报,我不能再键入命令了。这意味着什么?你不能从谷歌计算引擎发送邮件,谷歌会在25小时内阻止所有发送流量。您必须使用Sendgrid这样的第三方来发送邮件。
example@email.com... Connecting to [127.0.0.1] via relay...
220 instance-1.c.myproject.internal ESMTP Sendmail 8.14.4/8.14.4/Debian-8; Wed, 24 Aug 2016 09:42:18 GMT; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
>>> EHLO instance-1.c.myproject.internal
250-instance-1.c.myproject.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-DELIVERBY
250 HELP
>>> VERB
250 2.0.0 Verbose mode
>>> MAIL From:<info@instance-1.c.myproject.internal> SIZE=29
250 2.1.0 <info@instance-1.c.myproject.internal>... Sender ok
>>> RCPT To:<example@email.com>
>>> DATA
250 2.1.5 <example@email.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
Aug 25 07:56:02 instance-1 sm-mta[19958]: u7OCN1Wu013988: to=<example@email.com>, delay=19:33:01, xdelay=00:10:36, mailer=esmtp, pri=5340422, relay=alt4.gmail-smtp-in.l.google.com. [173.194.72.27], dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.
Aug 25 07:56:02 instance-1 sm-mta[19958]: u7OC9iDu013870: to=<example@email.com>, delay=19:46:18, xdelay=00:00:00, mailer=esmtp, pri=10560423, relay=alt4.gmail-smtp-in.l.google.com., dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.
Aug 25 07:56:02 instance-1 sm-mta[19958]: u7OBliSC013710: to=<example@email.com>, delay=20:08:18, xdelay=00:00:00, mailer=esmtp, pri=10740386, relay=alt4.gmail-smtp-in.l.google.com., dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.
Aug 25 07:56:02 instance-1 sm-mta[19958]: u7O94ubM013110: to=<example@email.com>, delay=22:51:06, xdelay=00:00:00, mailer=esmtp, pri=11460376, relay=alt4.gmail-smtp-in.l.google.com., dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.