Home » Php » php – Is there a way to determine whether an e-mail reaches its destination?

php – Is there a way to determine whether an e-mail reaches its destination?

Posted by: admin July 12, 2020 Leave a comment

Questions:

I have a PHP script that sends out critical e-mails that needs to reach its destination. I know how to check whether the e-mail sent successfully, the only issue is knowing whether it actually got to its recipient.

Any suggestions? If there is no way of knowing, how would you handle this situation?

How to&Answers:

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…

Answer:

Delivery Status Notification is the usual way: http://www.sendmail.org/~ca/email/dsn.html

You can’t tell if an email is read unless you use that microsoft email thing and the reader has not disabled read receipts.

Edit: I haven’t progressed to HTML email yet so I never considered that for a read notification.

Answer:

There’s no way to know for sure. Even if the remote server accepts the message, that doesn’t guarantee it won’t be filtered by a spam filter or otherwise.

Answer:

All the tracking links and webbugs assume that people actually open the email and enable remote images, or click links. Which is all flawed.

To make sure if an email is received and not returned, I’d do the following:

  1. Add Errors-To header (set to e.g. [email protected])
  2. Add Return-Path header (set to e.g. [email protected])
  3. Pick up the email box ([email protected]) and parse the emails

This lets you check when an email came back, based on the message content you can probably figure out which one bounced/came back.

Answer:

Unfortunately, there’s no 100% method for determining if a message was delivered to the user’s inbox. Even if the server accepts the message, it could get snagged by spam filters or bounced back asynchronously.

A lot of people have mentioned web bug tracking style techniques. These work well for marketing people: they can make assumptions based on sample size. They require HTML emails and that the user loads images in the HTML. This happens automatically in some cases, but a lot of the time people must specifically click a ‘download images’ button.

Another method is to use Goodmail. Part of their service is tracking which messages actually get delivered and opened. Of course, it costs money and not all mail providers are supported. Again, it’s mostly a marketing tool.

You could also have tracking scripts hidden in links. For example, you create a URL that looks like:

http://trackingserver/track/$messageid/http://real.url/goes/here

The track script then records a ‘click’ in the database and redirects the client to http://real.url/goes/here. You then need to have a compelling reason to click that URL every time.

Answer:

Why do you want to know that someone has read the mail?

Legally speaking, no way you might come up with will hold in court (say you want to make sure that someone has read an important document) because you can’t prove that the reader was the recipient.

Security wise, your mail will be flagged by any decent spam filter as spam and deleted before anyone can see it because adding strange links or web bugs or images in a mail is just what the spammers do. And if you want to sell something, this is a surefire way to make sure you won’t.

UPDATE: If you need to make sure people have read something, I suggest to send the mail with a link or a pointer to the document they should read. Don’t add web bugs or personalized IDs to the link. In the document, tell them to sign the document and return a signed copy as proof that they have read it.

Answer:

I guess all the above: images in the HTML, tracked links if they click on something. There are 3rd party services such as ReturnPath / Goodmail which can help.

The best advice is to ensure you’re sending list is clean, IP address has a good reputation, reverse dns/spf records, good unsubscribe and bounce handling on the campaigns, spam check on content, and get recipients to add you to their address book.

That will give you a better chance of delivery…

Sundeep.//

Answer:

Try this:

Write the email with HTML (it’s not that tricky with PHP).
In that email, include one picture (maybe just a pretty logo or something).
This picture will be a special picture… it’s src will be, say, myserver.com/images/[email protected]. This src will need to be dynamically generated for each person who is sent the email. Then, if the recipient opens the email, the email client will ask your server for [email protected]

So, if your server recieves a request for that image, you’ll know that [email protected] received your message.

You can create a special format for the tag at the end of the URL, so that it would not only tell which person it is, but which email they’re responding to.

Keep in mind, this is what spammers do to tell if an email address is active. So, certain software may ask the user if they think you’re spam! Also, some users won’t have image support (or will have this support turned off).

Good luck!

Answer:

If it’s internal, send the email, but don’t put the content of the message in the email. Provide a link to a web site and but an identifier in the url so that you can tie the page-view to the email.

You can still do that if it’s external, as long as the people on the other end are cooperative.

You can also set up a vanilla account on the destination mail system and check that. If you get the email at that account, odds are the system is not set to filter it out.

You can also ask the admins of the receiving system to give you a bounce-back on well-received emails (you know, script that curls your acknowledgment web page), but that would require a lot of cooperation. Although at that point, it might be easier to deliver the message through a web service.

Answer:

If I remember right as long as you send successfully, you can be assured that it has at least been accepted by the receiving mail server.

Answer:

A web bug might give you something like a read receipt, if that’s what you’re asking.

Answer:

The SMTP protocol is asynchronous, so the only guaranteed feedback can be returned by the users mail client. In case there are problems with the delivery you will get back bounce emails to the address defined in the envelope sender (mail header Return-Path) Timing of these bounces are unpredictable and undefined.
Tracking pixels in the HTML email body are so far the best way to report you that the user has actually opened the email.