简体   繁体   中英

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.

How would I go about doing this in Rails 3? Please be very specific and if possible, detailed, in your response, as I am new to Rails.

Many thanks,

Faisal

You can also leverage a third party service, such as Mailgun. These provide you with APIs that allow you to read in email delivered to a specific domain.

See http://mailgun.net/ , particulary their documentation on receiving emails. 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 has protocol helpers for SMTP (see 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

Cloudmailin converts your email to HTTP POSTs to a callback url that you specify. 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. 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. 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

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.

Well, this is not a trivial issue... and you will not solve it with rails only !

I think you will need at least to install a 3rd-party : an email server, like Postfix.

Here a few tutorials I've just googled :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM