Reputation: 5016
I build various web applications in PHP. Clients usually have the need for sending either email notification to users or internally.
I am plagued quite often by clients phone or emailing saying "joe smith never got the email notification and I did" or similar.
What is the best way to track email that actually we sent by your web app. I don't care about tracking after they leave my web server, I just want a log of "yes, that email got sent to joe and was bcc'd to the general office mailbox".
I have had promotional stuff sent from this company - click - but it is in beta. Does anyone know / used similar services etc?
Upvotes: 0
Views: 177
Reputation: 360562
Presuming your website uses a "local" mail server, such as Postfix/Sendmail/Exim, you'd check the mail log. Generally (on Unix-ish systems), that's /var/log/maillog. It'll contain the full transcript of the email's passage through the mail server, from the moment it was handed off from PHP to when it goes out the door to the recipient.
However, some accepting servers will LIE to you about the mail - they'll accept it with the usual "200 OK" success code, then just dump it in the trash because it triggered a spam filter or your IP/IP-block has been blacklisted somewhere.
You could embed a web bug in the mail so that (hopefully) the client's email program will ping your server whenever they read the mail, but most mail clients now block remote images by default, so this is very unreliable as well.
Basically, email is a best-effort-not-guaranteed-to-succeed business, and the entire system is set up to lie to you about everything.
Upvotes: 2
Reputation: 3185
Usually, php uses some sort of mailing program when you call the mail function. That program should have a log. For example, we use postfix. If I want to check if an email was sent: I just reference the postfix log.
Upvotes: 1