Email 如何从谷歌计算引擎使用sendmail和SendGrid?

Email 如何从谷歌计算引擎使用sendmail和SendGrid?,email,sendmail,google-compute-engine,sendgrid,Email,Sendmail,Google Compute Engine,Sendgrid,我有一个与Joomla一起运行的简单网站!,它有一个联系表,访问者可以从中向我发送信息。此邮件使用sendmail服务通过电子邮件发送 网站机器运行在谷歌计算引擎内,默认情况下我不能从它发送电子邮件(这是谷歌强加的限制)。为了实现发送电子邮件的目标,需要第三方服务,如SendGrid 我使用、验证我的用户等在SendGrid上创建了一个免费帐户。帐户已正确设置 据介绍,我将我的sendmail服务配置为使用SendGrid发送电子邮件。一切似乎都很好,但是。。。根本没有传递任何消息 我的邮件日志

我有一个与Joomla一起运行的简单网站!,它有一个联系表,访问者可以从中向我发送信息。此邮件使用
sendmail
服务通过电子邮件发送

网站机器运行在谷歌计算引擎内,默认情况下我不能从它发送电子邮件(这是谷歌强加的限制)。为了实现发送电子邮件的目标,需要第三方服务,如SendGrid

我使用、验证我的用户等在SendGrid上创建了一个免费帐户。帐户已正确设置

据介绍,我将我的
sendmail
服务配置为使用SendGrid发送电子邮件。一切似乎都很好,但是。。。根本没有传递任何消息

我的邮件日志位于
/var/log/mail.log
显示:

Jan 21 16:22:10 web-hosting sm-mta[16350]: t0JHWaec027559: to=<my@email.com>, delay=1+22:49:34, xdelay=00:00:00, mailer=relay, pri=23251559, re
lay=smtp.sendgrid.net., dsn=4.0.0, stat=Deferred: Connection timed out with smtp.sendgrid.net.
Jan 21 16:22:10网络托管sm mta[16350]:t0JHWaec027559:to=,延迟=1+22:49:34,xdelay=00:00:00,mailer=relay,pri=23251559,re
lay=smtp.sendgrid.net.,dsn=4.0.0,stat=Deferred:与smtp.sendgrid.net的连接超时。
,我的机器无法使用端口
25
465
587
,因此我更改了配置以使用
sendmail.mc
文件中的端口
2525
。没有什么变化


有什么提示吗?我的机器正在运行Ubuntu 14.04LTS。

好的,我发现了问题

我的原始
/etc/mail/sendmail.mc
文件没有
#dnl define('SMART_HOST','smtp.your.provider')dnl
行,因此我不知道将配置放在何处():

(注意:对于Google计算引擎机器,您需要使用2525端口,而不是默认的587端口)

问题是,你不能把它放在文件的末尾。当我将其放在“请勿触摸此处”部分之后时,配置开始工作:


您是否仔细检查了您的帐户是否正在发送电子邮件?您可以通过curl:
$curl-d'来测试它=destination@example.com&;toname=目的地&;主题=示例主题&;text=测试text正文&;从=info@domain.com&;api\u user=您的\u sendgrid\u用户名&;api\u key=您的\u sendgrid\u密码'https://api.sendgrid.com/api/mail.send.json
@HeitorSergent是的,当直接使用API时,我可以完美地发送电子邮件。
define(`SMART_HOST', `smtp.sendgrid.net')dnl
FEATURE(`access_db')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 2525')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 2525')dnl
dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE
...
DAEMON_OPTIONS(`Family=inet,  Name=MSP-v4, Port=submission, M=Ea, Addr=127.0.0.1')dnl
dnl # SendGrid code here