How can I check if an e-mail has been read using POP3/SMTP? - email

How can I check if an e-mail has been read using POP3/SMTP?
I am able to read e-mails, but I can not figure out if the e-mail has been read or not. Any suggestions are appreciated.

There is no completely reliable way to do this, while some servers support Read receipts it is dependent on the client to respond to the receipt request.
Another way people do this is by embedding a tracking image into an HTML email that will get pulled from a server and that hit constitutes the read however this is often not accurate as most email reader block html external content by default.

Sign up for a free account on statcounter.com. Goto the install code options, choose invisible tracking button and HTML only counter. Statcounter will now provide you an HTML Image snippet that you have to insert inside the body of your HTML email message.
The image isn't visible in the email but the person will have to click "Display Images" when they open their email client.
This is about the only way you can do it if your server or client does not support read receipts.

With POP3, emails are almost always deleted from the server after they are read. When a client connects to a POP3 server, the server usually transfers emails to the client and then deletes the email from its own storage. So, if you can read an email, chances are that it hasn't been read.

As far as I know this is a client side only detail when it comes to POP3. If you wanted to have the status reflected on multiple clients you'd need to used IMAP. With web mail readers they keep track of the unique message ID and whether or not it has been read on the client, but if you were to load it on a desktop pop3 client, it would not be flagged as read.

store the latest read email's message-id somewhere and check when you run to pop

There is no guarantee an e-mail has been read or not, especially 2 cases we won't receive a Read Receipt,
When user opens an email for the message a pop-up confirmation window opens, if user selects No then end user wont receive a read receipt.
From email settings, If user selects Never send a read receipt then also end user wont receive a read receipt.
If user enabled Read Receipt then, the request for the receipt is sent as a header attached to the mail using the method
MimeMessage.setHeader("Disposition-Notification-To", "email-id#domain.com");

Related

Email open tracking

I have to create email tracking system, but the problem is that when the sender opens an email this is counted as an opening by the recipient.
When I send an email through Polymail (or some other tools for tracking emails), then in the 'sent' folder I have an email without a tracking pixel, but the recipients of this email have the pixel and at the same time everyone have different code inside (I think, to determine which of the recipients opened the email).
How is this possible? The sender and the recipients have different contents of the same email. Can this be implemented using smtp / imap / gmail-api?
For standard IMAP/SMTP setups (specifically: not GMail), the message is submitted twice, once to SMTP to be sent, and again to IMAP to be placed in the Sent mailbox.
There is no requirement that these be the same: in fact, in normal use, the BCC header, for example, is submitted to IMAP, but not SMTP.
GMail, and a few others, while trying to be helpful and save bandwidth, do the copy automatically, but make it impossible to supply different versions. (Unless you want to try to find the duplicates and delete them out of band).
Current Email protocols don't send any kind of ACK to the Sender when mail is opened. So you need to put some kind of analytic tool inside the mail contents to keep the track of it.
Some suggested methods and widely used tool is Bananatag.
Alternatively, you can use custom Google Analytics for the same. Refer here https://dyn.com/blog/tracking-email-opens-via-google-analytics/

How to know that an email message was read?

I have a software that sends notifications, quotes and invoices to "clients of my clients" by email. Sometimes people don't answer it very fast, so someone needs to call by phone to confirm if they received and get the feedback. I would like to automate this, to know if them, at least, read the email. I know this is very difficult due to how email works, but some companies already try to do this in a satisfactory way, like:
mailgun.com
mailchimp.com
sendwithus.com (YCombinator funded).
In HTML mail messages we can create a resource that points to the server, like a image. But mail clients usually ask permission to the user to load the images. So, problem
here.
But for text mail messages? Is there any way to know the email was read? How companies these companies do?
PS: I don't know what tags is the best to classify my answer, I shall appreciate any edit.
There is no way to be 100% sure if a email was opened, because of its architecture. There are some techniques to do this, but it always depends of user actions and mail client configurations. But:
For HTML messages you can use images and/or the return receipts (RFC 3798).
For text based messages you can use only the return receipts (RFC 3798).
About opening tracking:
Opens are tracked by including a transparent .png file, which will
only work if there is an HTML component to the email (i.e., text only
emails will not track opens). You should note that many email service
providers disable images by default, so this data will only show up if
the recipient clicks on display images button in his/her email.
(Text extracted from mailgun.com user docs)
References:
MailGun.com documentation.
Previous discutions on this thread.
As arnt says, you're fighting the design and basic operation of e-mail. Whenever you send a mail, there is a boundary between a MTA you control (or at least have an account on) and a MTA that is responsible for your target user's mail. What you can know is whether the user's MTA accepted the mail for delivery. Whatever happens afterwards is outside of your control.
Consider an example of a snail mail. When the package enters the recipient's box, you won't know whether they put the whole unopened envelope to a trash bin, or whether they opened is and read the contents very carefully. You can approximate that goal by using crude measures (like embedding a webcam-and-a-computer which will activate upon envelope opening and send you the snapshot of the face of the opener via a cell phone), but doing so is unreliable, unethical, and probably illegal in plenty of countries.
The "return receipts" or embedded image links are similar -- because the whole e-mail is already in the hands of the user's SW, they can do anything with it. A good MUA will probably ask before sending out dumb return receipts, and it also won't load remote images in HTML mail (because it's easy to create an http://trackme.example.org/mail/for/user/12345/message/666/image.png and have a database which says "hey, this URL belongs to Mr. Pichler, and is used in the first message we sent him). The most you can do is to ask nicely, and return receipts (RFC 3798) are a machine-readable way of doing just that.

Verify the receiver has read mail and verify the receiver email ip

I'm working on the C# project whom allows the sender to send mail and:
Verify the receiver has read email or not?
Verify the receiver's email is located in Inbox or Spam...
Verify the receiver's email ip
Verify the receiver clicked the link on sender's email
I do not know how to start to deal with these problems :(
Thanks and appreciate you helps!!!
Short answer:
you can't do 1, 2 and 3 reliably/at all without deploying code/software on the receiver's side.
you can do 4 with link redirection.
On the basis that you don't have access to the recipient's computer, here are the long answer versions of patrix' short answer:
Verify the receiver has read email or not?
Unfortunately email has never been designed to let you know when an email has been received, and very few (and certainly no standard mail clients I know of) will report if an mail has been received correctly*, let alone opened. However, you can track emails sometimes by embedding an HTML image tag, and tracking when that image is downloaded from the server. There are a lot of caveats, such as it only working for HTML emails, and only if images are enabled, but that's one of the only 'reliable' methods for tracking email opens, and the most common method used by Mailing List providers (who need to think about this stuff a lot)
[* There is a feature known as 'read receipts' (technically Message Disposition Notifications or MDN) that many clients implement, but I believe few people ever use, which sends an email in response to reading an email. An email can request a read receipt by setting the appropriate header, but it is optional for the recipient to respond.]
Verify the receiver's email is located in Inbox or Spam...
Next to impossible; in the first instance, the concept of a 'spam' folder does not exist universally across all mail clients, and has never been a part of any email specification [to my knowledge]. In the second instance, as I mentioned, very few (if any) email clients report on the state of an email, let alone the folder it has been put into.
Verify the receiver's email ip
Again, not reliably, but you will make some headway in this if you implement image-based tracking as I mentioned in point #1
Verify the receiver clicked the link on sender's email
This is known as 'Clickthrough Tracking'.
This can be done, fairly 'easily'. Instead of providing a link directly to a location, you link to a tracking URL first. E.g. instead of linking to http://www.example.com, you should link to http://mydomain.com/TRACKINGID, which then redirects to http://www.example.com *. Then, on the server side, you can log when http://mydomain.com/TRACKINGID is visited. You can then put a unique tracking ID into every email for every recipient, e.g.
Recipient A receives a link to http://mydomain.com/TRACKIDA, and Recipient B receives a link to http://mydomain.com/TRACKIDB. both /TRACKIDA and /TRACKIDB redirect to example.com but, assuming you're logging HTTP requests, you can see who visited their link, where they visited from, when they visited the link, and how many times they visited.
This is the way all mailing list providers track clickthroughs, and roughly what you will need to do
[* Note that you will obviously require the relevant software to do this, e.g. with a 'simple' PHP page, or by using Apache mod_rewrite - whatever floats your boat, really]

How can a read receipt be suppressed?

I am programmatically "reading" emails using WebDav. I am also deleting these emails when I've finished having my way with them, however, this is causing an interesting problem. Each time I delete an email the original sender is getting a not read response. I have logged into Outlook Web App and checked the option Do not automatically send a response but this doesn't seem to help.
Is there ANY way to remove the request for read receipt from the email before deleting it?
We decided that we didn't want to make any modifications to our server and a solution that could be implemented in my existing program would be the most ideal.
I read on a few sites if the email was marked as read through IMAP commands on the exchange server that the read receipt would not be sent when deleted/opened via the client (Outlook Web App or Outlook). So that is what we did:
Logged into email server via IMAP
. LOGIN user#mailserver.com password
Selected the folder to process
. SELECT Inbox
Made the changes to all emails in the folder
. STORE 1:* flags \SEEN
This sequence marks all the emails in the inbox as read, which then allows my program to delete the emails after processing without a receipt being generated.

What's the best way to give the user weekly updates from your program?

I have a program that, for the most part, operates in the background. Let's say it DoesWork(). Once a week, I want it to notify the user on some of the work it has completed over the past few days. It will be a basic status report, listing some files that have been downloaded.
Initially, I wanted to sent this status update via email, so I looked into that but there are a lot of problems. I need an SMTP server so I looked at GMail. It's okay but has a daily limit of 500 emails, so this wouldn't be suitable for release. Also, there would be issues with the same email account password being given out in each copy of the program, which as I understand it, is a risk even if the password is stored using encryption.
Then I thought maybe I could use the user's own email account to send email to his/her self. This has a couple of complications too: the user would need to specify all of the smtp information for his/her email account, which is too complicated for the target user. Also, I don't want to have to have people entering their email account password into my program just to send emails. I don't think that's a good habit to promote.
Is there any way I could do this via email? Email was my first choice because it's a system of notification that users will already be checking. It's fairly non-intrusive.
Is it necessary to setup my own smtp server? If so, how can I do that?
If email is a no-go, I was also thinking about just generating a local HTML file with the relevent information, and then having a notification popup from the program once a week to inform the user that a new update report is ready. I think this is totally doable, it's just overly instrusive and not my first choice. I want to piggyback on a system that the user is already using.
Thanks!
-greg
An alternative is to have the program generate an RSS feed and direct the user how to subscribe to it. Also, once a new update is generated, show the update toast for about a minute, then hide it automatically and change your systray icon to something different. In about a day change it back to the original icon. Also, give the user a setting to turn the toast off permanently.
Relying on email is not a good idea, as you would have to collect the user emails and deal with the privacy issues for that, you would be effectively DOSing any third party SMTP server or would have to invest in the infrastructure for your own.
If I've understood it correctly, the user is running this program on his pc, in the background.
The perfect way to notify something would be, IMHO, giving the program is minimized to the traybar, a small popup that clicked, would open a window with a weekly report.
Hope this helps.
If you do get them to specify their own smtp server, make sure you put a "Send Test Email" button on there so they can test it. I know from experience that users always enter the wrong details when specifying a smtp server, user name, password, which is made worse since some smtp servers require a user name/password and others don't.
If they do enter the wrong details (or they change) then you might need to have some way to send them older reports, or to have some other way of notifying them that you can't send email.
Email's great, but you might need an alternative method also.
Google for simple smtp server windows gives you this
To be honest if you are just sending things once a week email is your best bet, as it's not frequent enough to garantee that the user will be at his machine to accept some other sort of request, which would require you to write proprietory software.
You could alternatively post it to an irc channel, or write an MSN bot to message the user, the message would be sent as an offline message if the user was offline.
I'd still go for email, it's tried and tested.
For a simple SMTP server I use hmail. I configure it to accept all SMTP requests from the local machine, regardless of source and destination, and to deny any SMTP requests not coming from teh localhost. This will be fine if you have a centrally located application.
If you want to distribute the app you have a whole different situation; with a lot of ISPs putting restrictions on SMTP traffic your best option would be to allow users to put in their mail account details and then use that to send mail. This will ensure everyone can put in working settings. Then use whatever library or pre-made code exists for yoru language of choice to send an email using those settings.
Does it need to be a weekly digest? Instead, how about using Growl (or equivalent) to notify the user of the tasks being completed in real-time, in the background?