2017 © Pedro Peláez
 

project mail

Advanced mail tracking using Twig and PHPMailer

image

schakel/mail

Advanced mail tracking using Twig and PHPMailer

  • Wednesday, December 28, 2016
  • by SirQuack
  • Repository
  • 4 Watchers
  • 1 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Schakel Marketeers Mail

Travis CI build status Code Climate rating Code Coverage PHP 7.0+ GPL-3.0 license, (*1)

Mail package that handles inlining CSS, creating plain-text versions of mails and tracking when users open and interact with mails., (*2)

Installation

Just require the package using Composer., (*3)

composer require schakel/mail

Examples can be found in the examples directory., (*4)

Features

This library has 3 main features:, (*5)

Preparing e-mails

Prepping e-mails can be a pain, and so can inlining stylesheets and other anomalies that the Wonderful World Of E-mail™ contains., (*6)

This library has a Schakel\Mail\MailUtils class that can take some of the pain away, but it gets even easier when you use the Schakel\Mail\Mail class that comes packed with this library, as it'll install a tracker for you at the same time., (*7)

The Schakel\Mail\Mail class contains a convertToPHPMailer method that returns a PHPMailer object. Other third-party extensions can easily be added as all the required information is scoped to be publicly available., (*8)

Tracking e-mails

To measure user-interaction, this library has a Schakel\Mail\Tracker\MailTracker class that handles linking individual e-mails to user interaction. This way you can measure when your users click on buttons in e-mails and when images are loaded (a fairly good sign that users are reading your e-mail)., (*9)

The MailTracker comes with a DCM file to easily use the class in your Doctrine Entity Manager., (*10)

Use Twig for mail templates

This library also has a package for Twig that'll allow you to tweak what URLs you want to throw through your tracker, and which you want to leave as-is. The extension provides two functions (track_url and track_image) that will change the URL to a trackable URL (when properly provided with the required objects)., (*11)


If you want implementation instructions, please have a look at the /doc folder., (*12)

Integrations

AltoRouter

The examples and the attached Schakel\Mail\Router\AltoRouterTrait make it a breeze to use this library with your AltoRouter installation., (*13)

Doctrine2

The lib/ directory contains ORM XML constructs that map the Schakel\Mail\Tracker\MailTracker to an object that can be managed by the Entity Manager. This makes tracking users easy when you use Doctrine, as all you'll need to do, is load this extra XML file., (*14)

Twig

There's a Twig template plugin available, which you can load using the addPlugin method on your TwigEnvironment. This adds the functions track_url and track_image to your template engine, which will generate relative urls to your tracking endpoint. See the example for more implementation of how to implement the tracker., (*15)

, (*16)

The Versions