2016-08-18 116 views
1

我很新,從服務器發送電子郵件,而只是試圖在我的虛擬機上設置電子郵件,所以我可以讓它發送crontab電子郵件(和更高版本在一些Python腳本將需要發送隨機通知類型的電子郵件)。在我的亞馬遜Linux EC2盒子上,這一切都很好用,但我在GCCE Ubuntu 16.04實例上遇到了問題。電子郵件無法從谷歌雲計算引擎通過谷歌應用Ubuntu Ubuntu的工作

我知道Google計算引擎實例上的Google always blocks port 25,但他們也指向documentation,似乎表明我仍然可以通過Google Apps使用SMTP中繼發送電子郵件。我特別不想使用SendGrid等第三方服務,所以這看起來像我最好的(只有?)選項。但是,該文檔似乎並未專門針對GCCE編寫。

當前狀態: 我能得到它做一些research幾個小時的工作,並沒有從我的crontab作業成功接收電子郵件。然而,第二天早上,我不得不重新啓動實例,從那時起(沒有其他變化點)我mail.log只是充滿了這個錯誤,我不再接收電子郵件:

Aug 18 17:17:56 my-master-compute-engine2 postfix/error[18060]: A7812BCE13: to=<[email protected]>, relay=none, delay=50875, delays=50874/0.13/0/0, dsn=4.4.2, status=deferred (delivery temporarily suspended: lost connection with smtp-relay.gmail.com[173.194.74.28] while performing the HELO handshake) 

我後綴的配置文件在我的'myorigin'文件中只包含我的域名,並且我已經事先在SMTP中繼中配置了所有這些,用於我的域名的Google Apps的Gmail設置(允許郵件僅來自指定的IP地址 - 我的vm external ip--而我不需要SMTP認證或TLS加密):

# Google Apps Relay SMTP, must use Port 587 because, 25 is blocked 
relayhost = [smtp-relay.gmail.com]:587 
# a file which should contain the google apps domain 
myorigin = /etc/mailname 

# Force ehlo behavior 
smtp_always_send_ehlo = yes 
smtp_helo_name = my.vm.external.ip # vm external ip (same that is configured in smtp relay in google apps) 

myorigin = /etc/mailname 
mydestination = $myhostname, my-master-compute-engine2.c.random-stuff.internal, localhost.c.random-stuff.internal, , localhost 
mynetworks = 127.0.0.0/8 my.internal.ip.address/32 [::1]/128 [fe80::]/64 
mailbox_size_limit = 0 
recipient_delimiter = + 

# limit smtp to loopback interface & compute engine doesn't support ipv6 
inet_interfaces = loopback-only 
inet_protocols = ipv4 

我怎樣才能解決這個具體問題,或周圍找工作?謝謝!

回答

1

從來沒有想過如何使用Google記錄的設置讓它工作,但我能夠通過我按照步驟here所做的不同隨機Gmail地址設置一個更簡單的基本SMTP中繼。