2008-12-24 79 views

回答

4

我这样做有ssmtp中。它充当SMTP服务器并代理真正的SMTP服务器。在Unix上(在这种情况下Ubuntu耐用),它使系统sendmail正常工作。

如果您还在使用Ubuntu,请运行apt-get install ssmtp以获取它。

这是一个基于我的示例配置文件。

# 
# Config file for sSMTP sendmail 
# 
# The person who gets all mail for userids < 1000 
# Make this empty to disable rewriting. 
root=postmaster 

# The place where the mail goes. The actual machine name is required no 
# MX records are consulted. Commonly mailhosts are named mail.domain.com 
#mailhub=aspmx.l.google.com 
mailhub=smtp.gmail.com:587 

# Where will the mail seem to come from? 
rewriteDomain=example.com 

# The full hostname 
hostname=yourhostname.example.com 

# Are users allowed to set their own From: address? 
# YES - Allow the user to specify their own From: address 
# NO - Use the system generated From: address 
FromLineOverride=YES 

# should turn on SSL & auth to google's SMTP server 
# TODO change this user 
UseTLS=YES 
UseSTARTTLS=YES 
[email protected] 
AuthPass=yourgooglepassword 

你会想要将它添加到您的environment.rbproduction/environment.rb

ActionMailer::Base.delivery_method = :sendmail 
ActionMailer::Base.raise_delivery_errors = true 
+1

我尝试这一点,但我得到了以下错误:在UsersController# 变量Errno :: EPIPE创建 管道中断 我测试了sendmail和ssmtp,并可以通过轨道外的终端发送电子邮件到地址。你有没有洞察什么可能导致这个或它的意思?谷歌搜索没有成功的解决方案。 – zalberico 2011-12-03 02:45:59

相关问题