OpenBuildings / postmark

Postmark transport for Swift Mailer
https://github.com/OpenBuildings/postmark
BSD 3-Clause "New" or "Revised" License
16 stars 8 forks source link

Support Postmark "Tag" and "TrackOpens" #6

Open jaketoolson opened 9 years ago

jaketoolson commented 9 years ago

PostmarkApp's API has additional methods "Tag" and "TrackOpens" http://developer.postmarkapp.com/developer-api-email.html#send-email

It would be nice to add these optional methods.

ivank commented 9 years ago

A nice suggestion :) 10x will try to implement at some point. The sad part is that from a quick poking around Swiftmailer I couldn't find a way to make this a "per message" assignment, it should probably have to be set directly to the transport...

jaketoolson commented 9 years ago

@ivank -- I came to the same conclusion. I was hoping to just add a method to message but it would almost require a custom extension of Swift_Message or a trait. The only other thought I had was listening to the swift events and doing it this way.

ivank commented 9 years ago

Swift employs special "X-Swift-...." headers to pass custom message data around internally.

https://github.com/webasyst/webasyst-framework/blob/master/wa-system/vendors/swift/classes/Swift/Plugins/RedirectingPlugin.php

We might be able to use some mechanism like this.

E.g.

// By doing this directly
$message->getHeaders()->addTextHeader('X-Swift-Postmark-Track', true);

// Or maybe by adding a static method to do that for us
Swift_PostmarkTransport::setTrack($message);