Rails 邮件程序 Ubuntu
在我的 Rails 应用程序(在 Mac 上运行)中,我使用了一个名为 pony 的 gem。当我通过 pony 创建消息时,我得到以下输出(从 Rails 控制台输出)。
#<Mail::Message:2186559360, Multipart: false, Headers: <Date: Tue, 13 Dec 2011 00:15:14 -0500>, <From: [email protected]>, <To: [email protected]>, <Message-ID: <[email protected]>>, <Subject: nothing>, <Mime-Version: 1.0>, <Content-Type: text/plain>, <Content-Transfer-Encoding: 7bit>>
此消息发送没有问题。
对于在 Ubuntu 上运行的单独应用程序,pony 会抛出错误。
我没有发布错误,因为我切换到了一个名为 mail 的 gem,它在发送消息后给出了相同的输出(没有错误,控制台说它发送得很好)。但问题是Ubuntu系统上没有消息发送。
我怀疑这是因为我从未在 Ubuntu 系统上设置过邮件系统(如果这是编程世界中需要完成的操作)。如果是,我不确定应该如何执行此操作,以便发送我的邮件。
我正在使用 Rails 3 和 Ubuntu Oneiric Ocelot。
In my rails application (running on a mac), I'm using a gem called pony. When I create a message through pony I get the following output (out of a rails console).
#<Mail::Message:2186559360, Multipart: false, Headers: <Date: Tue, 13 Dec 2011 00:15:14 -0500>, <From: [email protected]>, <To: [email protected]>, <Message-ID: <[email protected]>>, <Subject: nothing>, <Mime-Version: 1.0>, <Content-Type: text/plain>, <Content-Transfer-Encoding: 7bit>>
This message sends without problem.
For a separate application, running on Ubuntu, pony throws me errors.
I didn't post the errors, because I switched to a gem called mail which gives the same output after sending a message (no errors, the console says it sent fine). But the problem is that no message get sent on the Ubuntu system.
I suspect it's because I've never set up a mailing system on the Ubuntu system (if that's an action that ever needs to be done in the programming world). If it is, I'm not sure how I should do this, so that my mail will get sent.
I'm using rails 3 and Ubuntu Oneiric Ocelot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用外部 SMTP 服务器,而不是依赖操作系统来运行本地 sendmail(OS X 可以,但我猜您的 Ubuntu 不可以)。
对于测试和开发,您的 Gmail 可以正常工作:
如果您从生产应用程序发送电子邮件,则可以使用 中的廉价外部 SMTP 服务器http://sendgrid.com/。
Instead of relying on the operating system to have a working local sendmail (which OS X does, but I guess your Ubuntu doesn't), you could use an external SMTP server.
For testing and development, your Gmail will work:
If you're sending emails from a production app, you could use an inexpensive external SMTP server from http://sendgrid.com/.
进入ubuntu软件中心。搜索
(您需要的是邮件传输代理)
现在应该有一个叫做“mutt”的东西了。安装它。 (当我遇到这个问题时,它对我有用)
Go to ubuntu software center. Search for
(what you need is a mail transfer agent)
now something called 'mutt' should be there. Install it. (it worked for me when i had this problem)