TL/DR: Extract relevant information from notification emails and add them to your Analytics or CRM system to follow up on.
The above image is a typical email notification from Linkedin to let you know that someone has clicked the Like button on one of your recent Posts. It you wanted to add this persons details in to your CRM system so that you or one of your co-workers might follow up with them in the future or if you wanted to gather some Analytics data on successful posts, it is possible to extract this information easily and automatically from the email.
In some cases, an email notification such as this one is the only way to gather the information you need as the service sending you the email notification may not have any API or any other way to export data, so parsing the email might be your only alternative.
The first step is that the notification emails need to go somewhere. This can be a dedicated email address set up specifically to recive email notifications, or you could set up a Forwarding rule in your inbox to automatically forward any incoming notification emails to a dedicated email address.
The next step is to use a email service such as MailGun to create that dedicated email address so that you can set up an email address such as notifcations @ mydomain dot com. When MailGun receives an email to your chosen address, you can create a Route to POST on the content and headers of the email to your own application to store or parse.
You could use this PHP snippet to retrieve the incoming information (don’t forget to sanitize it first!) and log in, or process it on the fly.
Your next step would be to parse the incoming content from Mailgun. Mailgun sends you on plenty of information and you probably don’t want all of it.
The kind of parsing you do will depend on the content of the email you are working on. If you are going to receive different emails from different sources then you might want to create functions to parse several different email templates and use the email subject line as the marker to know which template to use.
Then depending on your subject line, you could send the email content to a function you have prepared to parse the data out of that template.
If you can parse the email content you would end up with a nice structured array of data from the body of the email, ready to save it directly in to your CRM package such as Salesforce or Analytics package.
You could go a little further too and determine the persons Gender based on their name so that you have further information to store.