我想测试我的ActionMailer类,但没有smtp服务器。我想用gmail发送这样的邮件。有人可以在谷歌和应用程序中的任何配置文件提供所有必要的配置样本?ActionMailer完整样例,使用GMAIL发送电子邮件
3
A
回答
5
GMail只有SSL SMTP可用,所以你应该通过Net :: SMTP创建一个SSL SMTP连接。
检查这篇文章:
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.rb
或production/environment.rb
:
ActionMailer::Base.delivery_method = :sendmail
ActionMailer::Base.raise_delivery_errors = true
相关问题
- 1. 使用Gmail发送电子邮件
- 2. Rails 4 actionmailer不发送电子邮件
- 3. Laravel 5.4用Gmail发送电子邮件
- 4. 使用烧瓶邮件通过Gmail发送电子邮件
- 5. 发送SMTP的Gmail电子邮件'发送邮件失败'
- 6. 通过Gmail发送电子邮件
- 7. PHP发送电子邮件GMAIL错误
- 8. 通过gmail发送电子邮件,Laravel
- 9. 从Gmail Rails发送电子邮件3
- 10. 通过Gmail发送Sitecore电子邮件
- 11. Gmail发送电子邮件超时
- 12. Gmail PHP API发送电子邮件
- 13. SwiftMailer + Gmail - 无法发送电子邮件
- 14. 从汞发送电子邮件到GMail
- 15. 电子邮件没有从C#使用Gmail发送电子邮件地址
- 16. 在笨通过电子邮件类发送电子邮件使用Gmail
- 17. 如何使用ActionMailer发送html电子邮件?
- 18. 每当宝石每日电子邮件使用actionmailer不发送
- 19. 如何使用Gmail API使用Rest Client发送电子邮件
- 20. Get Devise 1.3.4在开发中使用Gmail发送电子邮件
- 21. 使用ActionMailer发送带附件的邮件时,电子邮件正文缺失
- 22. 用c + +发送电子邮件与Gmail Gmail(安全层)
- 23. 使用Gmail从CakePHP应用程序发送电子邮件
- 24. 使用Gmail发送邮件
- 25. Rails 4 - ActionMailer发送送货确认电子邮件
- 26. 发送HTML电子邮件与内嵌图像用的ActionMailer
- 27. 使用“Rails 2.2.2 + Gmail”发送电子邮件
- 28. 使用SwiftMailer通过Gmail发送电子邮件
- 29. Gmail API - 在javascript中使用oAuth2.0发送电子邮件
- 30. 使用Gmail设置发送电子邮件时出现问题
我尝试这一点,但我得到了以下错误:在UsersController# 变量Errno :: EPIPE创建 管道中断 我测试了sendmail和ssmtp,并可以通过轨道外的终端发送电子邮件到地址。你有没有洞察什么可能导致这个或它的意思?谷歌搜索没有成功的解决方案。 – zalberico 2011-12-03 02:45:59