Generating a new email address on the fly, but not really! - ruby-on-rails

I have a blogging application. Once a blog-post is created by a user, it will be sent as an email to some of user's friends. I want a functionality where the friends will just reply to the email and the content of the email will go as comments for that particular blog-post.
One way to do this is to do something similar to what http://ohlife.com does. It basically creates a unique ID per user per day, has the reply-to attribute of the email set to post+{unique_id}#ohlife.com and probably parses this field to know which user is the email for, when it gets received. But it really has only 1 email address which is post#ohlife.com. The part after the "+" get's ignored by email servers. This also is applicable to gmail.
What I wanted to know, is whether this property is for particular email servers or is it universal? If it is not universal, is there is email server independent way of implementing this? I would not want this to be based on the email subject, as it's the trivial solution I know of.

it is depending on your mail server and how it is configured.. (although it is quite a standard) - for example in postfix:
recipient_delimiter = +
you could set it to anything you like .. i once configured it to be a dot so i can use it all over the web.. http://www.postfix.org/postconf.5.html#recipient_delimiter
but you could simply make it configurable in your application as well..

Besides using the email subject or address, one other easy way to accomplish this would be to just stick an identifier number at the bottom of the outgoing email's body. It would then come back to you in the quoted part of the response message. This is much less obtrusive than putting stuff in the subject or address, and if you're using HTML messages you can even make the code invisible.

Related

Mandrill - detect forwarded emails?

Is there a way to detect if an email sent via Mandrill has been forwarded by the recipient to someone else?
The email will contain links (click tracking can be on). I'm wondering if somehow if the recipient of the forwarded email clicks any of the links that it could be used as an indicator that the email was forwarded.
Or perhaps some other approach?
There is not a way.
Unless that same message you sent gets forwarded from recipient 1 --> recipient 2 --> back to you (you would check headers), there is not a way. In order for this to even be an option, whoever your recipient uses as an email server/client, would have to be built with this functionality.
- Below is merely added to show a very limited potential to track emails being forwarded.
You could potentially reference an embedded image on the internet (something you can track), AND* if the "forwarded recipient" allows images to be viewed, you MAY* be able to see the IP's that have accessed your image you referenced in the email.
AND* = Image viewing is rarely ever enabled. User has to allow this to happen on a per-email basis.
MAY* = Now you run into the hassle of trying to understand your recipients network and if many people share public IP's (think home networks or small businesses, cheaper for internet provide to assign one IP to house/building)
You would THEN have to go into the hassle of tracking down an IP to a person.
As i know it is not posible to track normal forwarded e-mails. I mean mails that are forwarded with the "forward" button of the mail client.
I've seen some times an "Click here to forward" button in news letters. When you click on that button you go to an web page where you can put the mail address of the recipient. When you click on the send button an exact coppy of the newsletter is send to the mail addres which is typed in the textbox. With this method you can track the forwards.
The problem is that not everyone uses this method (so uses the default forward button). To trigger people to use your button you can give them something special (discount or credits where they can get something with). A second thing is that you need to put the button on the top of your mail for the best result.
If it is posible with Mandrill i cant tell you but i read in this topic the Mandrill support is good so maybe you can mail them. You need to do an fund first so you can get use the support but they can tell you if it is posible and how.
Link to Mandrill support page
Though I haven't used it, I believe it is possible with Merge Tags. Refer the below
The MailChimp *|FORWARD|* merge tag generates a link to an online form where recipients can share your email with others. Because Mandrill emails are generated and tracked individually, a web version isn't provided automatically.
More details can be found here

How to ensure unique users registration

I wonder what is the best way to ensure unique users. I will issue a common instruction to 100 people to my website. Once they come to my site, I'll need to allocate them to North south east west region, one after another. I also need to prevent one user from having many accounts. (The user may use another computer / their phone to access)
What is the best way to do this in grails?
There no way to be 100% sure that all users are uniq, btw you if you gather and validate as much details as possible, like:
email (you know), easy to counterfeit btw
cell number (send text message with special code to confirm number), but user can also use a friend number, or buy new one
ask for scan of person ID, and/or
address verification (require scan of bill/other pappers with full user name and address on it, or send a letter to this address with special code to confirm)
Are you controlling who gets the initial instructions, like from a contact list or something? If so could include a "registration key" and only let a particular key register once, or only let those particular email addresses be used to register (once), or even create the users ahead of time and send them the instructions to login.

Email creates new record in rails3?

I'm not really sure where to start with this one, but here is what I'm looking to do.
Lets say you've registered at a website (yourwebsite.com). Your username/email is joe#shmoe.com.
If you email newrecord#yourwebsite.com, I'd like a new record created by your user (meaning you have to email it from a registered user's email - such as joe#shmoe.com).
I'd also like to add some variables in the email body, that can be set to their respective fields in the new record.
Does anyone know if this is possible?
sure is possible - have a look at http://cloudmailin.com/ too - they do all the receiving side of things for you and then just 'post' the email into your application.
It's definitely possible - that functionality is available in basecamp.
I've never done it myself, but looks like this article describes how to process incoming emails in rails. Good luck!

Email threading

I'm working at a helpdesk application where i have a standalone script that queries a mail server and parses the mail it finds there.
I'm facing the following issue: How do i figure it out in a reliable way what mail is in reply to what mail?
I could add something in the subject like "[ticket:21312]" and look for that but what if the user changes the subject? Is there another way? Can i do it by setting a custom mail header and look for that or the header will not be preserved between mail servers on reply back from user?
What about when i send a message from my application to a non existing user or a user that has quota full and his server replies back with the usual standard message "the mail daemon at .... could not ...." then the subject will also be modified and i can't place the message correctly as a reply to an existing mail.
How does gmail do it? There the messages are sorted perfectly in almost all of the cases.
in helpdesk email piping there are 3 basic methods:
a) include the id in the subject somewhere (works fine in practice)
b) have the id in the body somewhere
c) use an auto-generated email alias with the id, like "case-76236781980893#helpdesk.mycompany.com". that can easily be handled by something like procmail or a script to pick out the id.
gmail might use a combination of the subject, In-Reply-To header (may not be defined) (References and Original-Message-ID headers possibly as well), and various heuristics, which work very well, but of course not necessarily bulletproof, and slightly more involved to implement. something like nestscape's original threading algorithm perhaps. though some have reported that gmail doesn't use the In-Reply-To header and relies mostly on the subject (as in this post).
As you say custom headers might get lost and the subject might change. Use both. If one exists then you can identify the thread. I don't know of any better way to solve this.
If your message was sent with a Message-ID-Header any standards-conform mailer should add a In-Reply-To-Header referencing your Id. Additionally Referencesshould contain a list of all previous mails in this thread.
This works with most mail clients, to be safe for the bad clients you have to use the subject, the easy way is by adding the "[issue:123]" thing, a secondary fallback is to recognize the subject (after cutting of the "Re:" part in all the variations) for this it could help that you know most of your legitimate senders ...

Newsletter: How is it possible to determine how many people opened the e-mail?

Exact duplicate of Is there a way to determine whether an e-mail reaches its destination?
Hi all,
I heard that it's possible to determine how many people opened a newsletter and analyze WHEN they opened the mail.
I just wanted to know how that's possible... is it necessary to generate a "read confirmation" or is such an analysis possible without letting the recipient know?
Thanks a lot for your input...
See also Is there a way to determine whether an e-mail reaches its destination?, my answer repeated below:
If you make the email HTML based, you
can include images in it which contain
URLs with information unique to the
recipient. You could structure your
application so that these URLs trigger
some code to mark that particular
email as read before returning the
required image data.
To be totally effective, the images
would have to form a key part of the
email, so that the recipient has to
make their email client grab the
images. You could also make the plain
text part of the email just contain a
URL to retrieve the full message,
again allowing you to track receipt.
How far you take these ideas depends on why you need to know it's been read
and to what extent you want to
potentially annoy the recipient with
an email they can't cut'n'paste, read
easily on mobile device, listen to
with a screenreader, etc...
There is no way to guarantee that someone has opened your newsletter e-mail. But you can get a clue of how many time it was opened by embedding a one pixel image in you mail and use the statistics of you web server to determine how often it was requested.

Resources