[英]How do I create anonymous email addresses (e.g. abcd11245@craigslist.org) for users in a Rails 3 app?
I am running a Craigs list style notice board, for which I need to create anonymous email addresses (eg 123fghuii@craigslist.org) with forwarding for people who create posts. 我正在运行Craigs列表样式公告板,为此我需要创建匿名电子邮件地址(例如123fghuii@craigslist.org),并为创建帖子的人员转发。
How would I go about doing this in Rails 3? 我将如何在Rails 3中执行此操作? Please be very specific and if possible, detailed, in your response, as I am new to Rails.
请非常具体,如果可能的话,请在回复中详细说明,因为我是Rails的新手。
Many thanks, 非常感谢,
Faisal 费萨尔
You can also leverage a third party service, such as Mailgun. 您还可以利用第三方服务,例如Mailgun。 These provide you with APIs that allow you to read in email delivered to a specific domain.
这些为您提供的API允许您读取传递到特定域的电子邮件。
See http://mailgun.net/ , particulary their documentation on receiving emails. 请参阅http://mailgun.net/ ,特别是关于接收电子邮件的文档。 http://documentation.mailgun.net/user_manual.html#receiving-messages .
http://documentation.mailgun.net/user_manual.html#receiving-messages 。
You could also build your own evented SMTP server using something like EventMachine, where your Ruby code will listen for all email delivered and handle the TO: headers in a message. 您还可以使用EventMachine之类的东西构建自己的事务SMTP服务器,您的Ruby代码将监听所有已发送的电子邮件并处理消息中的TO:标头。 EventMachine has protocol helpers for SMTP (see http://eventmachine.rubyforge.org/EventMachine/Protocols/SmtpServer.html ).
EventMachine具有SMTP协议助手(请参阅http://eventmachine.rubyforge.org/EventMachine/Protocols/SmtpServer.html )。
I have implemented this and had a look at a few solutions. 我实现了这个并看了几个解决方案。 By far the most simple I found was http://cloudmailin.com
到目前为止,我发现最简单的是http://cloudmailin.com
Cloudmailin converts your email to HTTP POSTs to a callback url that you specify. Cloudmailin将您的电子邮件转换为HTTP POST到您指定的回调网址。 From that, you can pick out the sender and the message.
从那里,您可以选择发件人和邮件。
There are a few things that make it really useful. 有一些东西使它真正有用。 First of all, you can specify a wildcard MX entry, which will send all of your emails to the callback url that you specify, meaning that you can perform different actions depending on the email address that is emailed to.
首先,您可以指定一个通配符MX条目,该条目会将您的所有电子邮件发送到您指定的回调网址,这意味着您可以根据通过电子邮件发送到的电子邮件地址执行不同的操作。 The second thing I found really useful is that there is an option to strip out your attachments and store them in an S3 bucket.
我发现的第二件事非常有用,就是可以选择剥离附件并将它们存储在S3存储桶中。 A combination of these two making dealing with emails that have attachments far easier than implementing your own mail server.
这两者的组合使得处理具有附件的电子邮件比实现您自己的邮件服务器容易得多。
Please note that there is a small cost involved, you can see the plans at http://cloudmailin.com/plans EDIT - There is a free plan available but it doesn't include the things mentioned above 请注意,涉及的费用很少,您可以在http://cloudmailin.com/plans 编辑中查看计划 - 有免费的计划,但不包括上述内容
One other advantage of this is that you are not tied into the rails stack (don't get me wrong, I love rails), because it is an HTTP request you can very simply implement the same callback url in any technology stack. 这样做的另一个好处是你没有绑定到rails堆栈(不要误会我的意思,我喜欢rails),因为它是一个HTTP请求,你可以在任何技术堆栈中简单地实现相同的回调url。
Well, this is not a trivial issue... and you will not solve it with rails only ! 嗯,这不是一个微不足道的问题......你不会只用rails来解决它!
I think you will need at least to install a 3rd-party : an email server, like Postfix. 我认为你至少需要安装第三方:电子邮件服务器,如Postfix。
Here a few tutorials I've just googled : 这里有一些我刚刚用Google搜索的教程:
http://capturedsparks.com/2008/06/receiving-emails-with-ruby-on-rails/ http://capturedsparks.com/2008/06/receiving-emails-with-ruby-on-rails/
http://railspikes.com/2007/6/1/rails-email-processing http://railspikes.com/2007/6/1/rails-email-processing
http://jasonseifer.com/2009/04/24/receving-email-with-rails http://jasonseifer.com/2009/04/24/receving-email-with-rails
http://blog.sosedoff.com/2011/08/10/processing-emails-with-postfix-and-rails/ http://blog.sosedoff.com/2011/08/10/processing-emails-with-postfix-and-rails/
One of the biggest misconceptions about anonymous email addresses is that they are only used for unsavory criminal activity. 匿名电子邮件地址最大的误解之一是它们仅用于令人讨厌的犯罪活动。 In reality, they're a prudent method for protecting online privacy and shielding yourself from spam.
实际上,它们是保护在线隐私和保护自己免受垃圾邮件侵害的谨慎方法。 Craigslist Email Account
Craigslist电子邮件帐户
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.