how can we track the status of email sent from drupal - php

Hiii
how can we track the status of email sent from drupal. I want to know all the email sent from my site is delivered to client mail or not. I delivered also want to know it is read or not.
Is it posssible. if possible how can we do this...

One option is to send the email in HTML format and include a small (1px square) transparent gif, served from a PHP script on your server, with the unique id of the email appended as a GET parameter in the gif's URL. Your script can then log which emails have been opened using drupal's watchdog() function or whatever.
This is not foolproof of course, as some people's mail clients automatically refuse to download images (in order to prevent this sort of tracking by spammers) or will open HTML email in plaintext mode e.g. mobile clients. However, this could still be useful to you, depending on your situation.
The CiviCRM Drupal module provides this functionality as it's focused on political campaigning and read tracking is potentially helpful even if it's not perfect, but you'd have to use the CiviMail component to send the messages if you want to use this (it also tracks bounces, so not a bad solution).

You can't. Once it's been handed over to the mailer daemon you have no control over it any more.
There are ways of seeing if the message was received, but none of them are reliable. You can request a receipt, but the user is under no obligation to send one, and they may by annoyed by the request. You could embed a web bug (a link to an image that actually runs a script to log the fact the mail was received), but they are easily blocked and you could only use them with HTML mail anyway.

Related

Pixel Email Tracking not working for Gmail [duplicate]

I was implementing pixel tracking for a gmail web service, but since today google has changed the gmail client to proxy linked images !
Is there any work around, as the proxy is giving my server a fake/masked ip and location?
This is true. gmail has been proxying all user content via it thus showing Mountain View,CA as its REMOTE_ADDR. This is true only for gmail clients. The same logic has not been working on Gmail via outlook or any other mail client.
Most email tracking companies rely on these details to differentiate the recepients of the mail.
I dont think there is a work around. But if there is one we would find out soon given that these companies have a lot to lose.
Meanwhile, you could try using HTTP_X_FORWARDED_FOR or disposition notification headers. But given that this can be messed with, there isnt much option left but just go back to making people click on links!!!
In my experience as of Aug 5 2018 my emails sent with a tracking pixel are blocked by google. I uncheck the send tracking pixel box in my crm and the message arrives instantly. The tracked email never arrives.
I made a video to show but its exactly as I just described and quite boring to watch lol. BUt you get the point. Obviously this is just in my experience but it's too bad because knowing if my clients read it is only way know not to keep sending the same message in a different way assuming it went to spam.
Looks to me like they're caching, not just proxying.. I whipped up a PHP file to output a random image selected out of a collection of 5 images... It's the same image each time.. Testing against Yahoo! mail and outlook, both of which change each time the email is opened..

Email to trigger PHP Script... Possible?

I'm in need of setting up an auto-response from an email account that I control, based on trigger words within the body of the email. But also, it needs to add/delete rows from a database table based on trigger words sent to this email account (that belongs to my site) and it needs to create a topic, in some cases, within a forum, if sent to a different email address (but on the same server). I know PHP to be able to do this, but not really sure how to trigger a PHP script to be executed when an email gets sent to a specific email address account that I control. Or if there is another solution to accomplish this, please let me know.
This is basically an inquiry on how to accomplish something like this, based on an email sent to a specific email address on my server with words like: "Join", "Leave", "Set Mail", "Set Digest", etc. etc.
There will be another email address account set aside that will need to send those subscribers in the database, the same exact email (Mass Send). This is for a CDB-L ListServ. Kind of old school I suppose, but we want to transfer this ability to our server, since these old school methods still work today and is very much active.
Curious on security issues, what type of server software I'll need and just a basic approach on how to set something like this up.
You can alias your email address directly to a php script if you run your own mail server (on linux this would just be in the /etc/alias file or equivalent where the target was your php script instead of an email address) eg http://www.topwebhosts.org/bbs/board.php?bo_table=server_mgmt&wr_id=73
If not, then your only real choice is to set up a php process that checks an email address for mail every x minutes.
I have used both these methods over the years to great success
You can walk through emails with PHP's IMAP functions and undertake action (based on conditions/content). More info.

PHP Force remote image download or remote requests inside an email

I am sending our HTML newsletters with an image on each email that help us know if a person actually received that newsletter.
I just add in the HTML body of the email a img tag like that:
<img src="https://www.example.com/read/BASE64URLENCODED_DATA" />
BASE64URLENCODED_DATA is something that I can read on server when the request arrives to know the email address that downloaded that image. We receive the request to download that fake image, we save the data and return some headers to show a transparent image of 1x1 px.
The problem is that usually this works for no more than the 10% of the total emails sent on each newsletter. This means that most of the email clients that receive our newsletter don't permit the downloading of images (showing the classic message "If you want to download attached images click here...").
Is there any way to force an email client to make a remote request like that?
We need to produce more realistic statistics for our newsletters but we can't find a way to force this remote requests or fake images download.
Thank you.
A longer answer - there may be ways how you can trick some e-mail clients, but this will work only on a particular client. There are lots of different clients out there. Maybe you find a way of tricking Oultook, but no guarantee that it works for Google Mail or other web mail service. Then there is Roundcube, Squirrelmail, Horde and other web clients. Then the mobile devices come in - iPhone/iPad mail client, Android mail clients, Outlook mobile.. No, you don't want to do this.
And even if you find a way of tricking all those programs (which I highly doubt), most likely your message will be malformatted and most spam filters will catch it as spam.

Dynamic Mail Forwarding Based on Superscription Table

Client asked this morning if we can provide a subscription service whereby:
Mail arives to a specific address on a cloud mail server with no procmail/maildrop possibilities
Cron runs Perl or PHP script on another server which checks for new mail and based on address mail purports to be from, does a subscriber look up, and forwards the email with any attachments to all subscribers along with an added unsubscribe link
Script deletes forwarded email
Mail server will have both IMAP and POP access, apparently.
// EDIT
Note that mail will be from 220+ governmental agencies/organizations. Users will use interface to specify which organizations they wish to receive forwards from. In order to run like a traditional mailing list we'd have to set up 200 mailing lists and then make an interface to handle subscriptions. The proposed interface will allow 1 - 200 subscriptions with a single opt-in confirmation email and a single opt-out interface.
// END EDIT
Client has been warned that header spoofing is child's play and that viral attachments are a serious concern and is willing to proceed nonetheless.
So, with the caveat that this is NOT an idea that I endorse what libraries have you used to accomplish this sort of task?
You do not mention what kind of mail server you are dealing with. Perl has Net::IMAP::Client and Net::POP3 to handle fetching mail.
For sending email using an SMTP server, there is Email::Sender or Net::SMTP or Net::SMTP::SSL.
At a minimum, you'll need an email account which you can use to send emails (this might be the original account that receives the messages).
In between fetching and sending, you can check for spam using Spam Assassin and for viruses using ClamAV.
I don't know why the original messages need to be deleted, but at the very least, I would log every single step in detail.
What you're describing is a mailing list. If at all possible, you should look into using one of the several existing software packages designed for managing such lists, such as majordomo, ezmlm or mailman, rather than trying to roll your own.

Processing input data from a phone though SMS

I currently have a php script that reads email messages sent from phones and then it posts them on the internet...
I want to do the same thing but instead of reading emails, I would like to process the data through a SMS.
so, if someone sends a sms to X number, my program would get the message through this X number and use it in the site.
What would I need?
You have a lot of options here. Generally speaking you need to first acquire the number that people can SMS to. Afterwards a callback will be issued to you when someone sends and SMS and your PHP script can process the message and figure out what to do with it.
You essentially have a few options for exposing the SMS
Go with a dedicated short-code. Eg someone sends a text to 53234 and you will get a callback to deal with it. This is an expensive option. It will cost you generally around $2500/mo minimum not including per messaging fees. You can requisition a short code through a provider such as Open Market. You have to get approval for the short code which might take as much as 6 weeks.
Go with a shared short code. This is a bit cheaper -- you pay per message and it usually costs anywhere from .02 - .10 /msg depending on your msg volume. You get a keyword such as DOLLY that people have to preface before texting. So they would text DOLLY INPUT TEXT HERE to 53234 now and you would receive the callback with INPUT TEXT HERE. Celltrust and others provide shared short codes.
Use a public api that allows people to text in through something such as TextMarks. Textmarks is like a shared short code requires keyword usage + users to subscribe. However it is free which is great and has a nice callback API. I believe a service called Mozes also provides similar service. Finally, if you want you can set up a Twitter account and have people text to their number. Facebook also a similar API that allows you to use their FBOOK shortcode.
Ish's answer was great. I'd like to point out an additional free option.
Most carriers allow you to send SMS messages to email addresses. The SMS text gets inserted into the body of the email and the subject is carrier dependent. Once the email is sitting in your inbox, you can access it by the method of your choice.
This method has worked for me in a personal project requiring remote communication with my computer when all I had was a cell phone without internet capabilities.
This Wikipedia page shows how many carries support this (practically all).
Just try not to violate anyone's terms of service, you could always host the email account yourself.

Categories