简体   繁体   English

如何为Rails 3应用程序中的用户创建匿名电子邮件地址(例如abcd11245@craigslist.org)?

[英]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搜索的教程:

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.

相关问题 如何获取我的Rails应用程序的基本URL(例如http:// localhost:3000)? - How do I get the base URL (e.g. http://localhost:3000) of my Rails app? 如何手动创建嵌套的POST参数? (例如,我在.Net中创建请求以联系Rails后端) - how do I manually create POST parameters that are nested? (e.g. I'm creating the request in .Net to contact a Rails backend) 使用Rails验证,如何将一个短语列入白名单,例如“ Learn Ruby” - Using Rails validations, how do I whitelist a phrase, e.g., “Learn Ruby” 如何使用Rails中的minitest测试我的控制器中的(例如)@project.save的失败? - How do I test for failure of (e.g.) @project.save in my controller using minitest in Rails? 如果用户未使用我的Web(导轨)应用程序(例如使用API​​),我该如何对他们进行身份验证 - How do I authenticate a user if they are not using my web (rails) application, e.g. using an API Rails应用程序具有一组模型,但是有两个服务器进程(例如,用户和管理部分是分开的) - Rails app with one set of models, but two server processes (e.g. users and admin sections are separate) Rails:创建记录(例如,用户)后,更新另一个表(例如,不是用户表)吗? - Rails: After creating a record (e.g. a user) update another table (e.g. not the users table)? Ruby on Rails问题-如何从请求首次命中应用程序时开始衡量响应时间? (例如,使用“基准”) - Ruby on Rails question - how can I measure response time from when request first hits app?? (e.g. using 'benchmark') 在 heroku cli 中,如何在管道应用程序上运行命令(例如 rails c)? - In the heroku cli how to I run commands (e.g. rails c) on pipeline apps? 如果我想做Javascript,AJAX之类的东西,是否需要服务器端知识(例如Django,Rails)? - Do I need server-end knowledge (e.g. Django, Rails), if I want to do Javascript, AJAX stuff?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM