Email/Ad/Marketing 20100130


Published on

An overview of email-marketing in twenty-five slides.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Email/Ad/Marketing 20100130

  1. 1. Email/Ad/Marketing<br />10,000 Thoughts in 25 Minutes<br />Dustin Oprea<br />
  2. 2. Areas to Cover<br />Email Composition<br />Email Storage<br />Email Processing<br />Ad Presentation Concepts<br />Ad Document Handling<br />
  3. 3. Email Composition<br />Laws<br />Deliverability<br />Individual ISP Whitelists<br /> Comcast<br />Yahoo<br /> AOL<br />Commercial Whitelists<br /> Bonded Sender<br />Habeas<br />
  4. 4. Email Composition<br /><ul><li>Deliverability (cont’d)
  5. 5. Well-formed HTML
  6. 6. If you produce an HTML message, it’s absolutely essential that you produce a multi-part email and include a plain-text stub, otherwise you’ll lose points if/when your emails are scored.
  7. 7. Emails should be built using the Quoted-Printable MIME format, which allows for international language support.</li></li></ul><li>Email Composition<br /><ul><li>Emails should be built using the Quoted-Printable MIME format, which allows for international language support.
  8. 8. Standard PHP tools for email building
  9. 9. IMAP PECL extension
  10. 10. Mail_Mime PEAR extension
  11. 11. Mail()
  12. 12. Make sure you set the envelope-sender with the –f option in parameter 5, otherwise all of the sender information won’t exactly match.</li></li></ul><li>Email Composition<br /><ul><li>Per the Mime RFC, the message-ID sent with each message (if provided) has to be unique. To ensure this, you might do a hash of the time combined the body’s hashsum.</li></li></ul><li>Email Composition<br /><ul><li>Our company’s message-ID scheme:</li></ul>// Get the first five characters of a hash of the time and a random number.<br />RandomizerValue = rand();<br />RandMD5Part = substr(md5(time() . RandomizerValue), 0, 5);<br />
  13. 13. Email Composition<br />// Create the message-ID.<br />//<br />// RandMD5PArt: Ensures that the message-ID is random.<br />// MAC: Message Authentication Code that can be regenerated with<br />// by us only that tells us the ID hasn&apos;t been changed.<br />// Reference Number: A promotion number, for example.<br />// Customer Number: &lt;obvious&gt;<br />// Email Type: A number describing if the email is a normal promotion, <br />// a prospecting letter, etc.<br />Message-ID = &quot;&lt;RandMD5Part&gt;.&lt;MAC&gt;.&lt;ReferenceNumber&gt;.&lt;CustomerNumber&gt;.&lt;EmailType&gt;;<br />
  14. 14. Email Storage<br />A natural part of the ad-production process is pulling down images and documents from emails sent to you by designers.<br />Obviously it’d be inefficient to do this using Thunderbird on your workstation and then sending it to the server for publishing.<br />We developed a library of mail functionality and a suite of hand-utilities too.<br />
  15. 15. Email Storage<br />We did this using the PHP PECL IMAP extension (which handles POP, too, which IMAP inherits from).<br />We had to bridge shortcomings by also developing a library to directly communicate with IMAP servers.<br />This was primarily because the PHP library may say it supports UIDLs (unique message numbers), but it will just ignore any desire to do this. It’s just not implemented.<br />
  16. 16. Email Storage<br />We wrote a utility to allow rapid, “hand-scanning” of your email box using “from” and/or “subject” search terms, that then lists the times, UIDLs, senders, attachment quantities, and subjects of emails.<br />We wrote a utility to dump the attachments of any one email, and all attachments of all results found in the above utilities.<br />We’re currently developing a robot to automatically scan our emails and throw warnings if an ad has not been received by the normal send-date.<br />
  17. 17. Email Storage<br />The way to accomplish email storage is to maintain a local cache. There are two important points to remember while you’re communicating to a POP/IMAP server<br />Mail clients have exclusive access to a server. Only one can be connected at a time. Example: Yahoo will wait to allow you into webmail until a connected client is disconnected.<br />Messages are indexed from 0 to (num – 1), where the newest is at position 0. Therefore, you can only depend on these designations to remain unchanged for the current connection only.<br />
  18. 18. Email Storage<br />The first thing that needs to be done is, therefore, to connect to the mail-server directly to get a mapping between these indexes and their UIDLs (which we won’t know until we get the mapping).<br />The UIDLs will only be used to store header information files for each individual message, and allow us to differentiate new messages.<br />
  19. 19. Email Storage<br />Keep in mind that since normal POP/IMAP communication is unencrypted, you can directly type commands to the mail server via a telnet session opened to port 110 of the server.<br />You can open a conversation by using fsockopen() and then set blocking via stream_set_blocking() so you wait on responses.<br />
  20. 20. Email Storage<br />A typical mail conversation:<br />OK xxx<br />USER myusername<br />OK xxx<br />PASS mypassword<br />OK xxx<br />UIDL<br />OK xxx (followed by an extended response)<br /> yy zzzzzzz<br /> yy zzzzzzz<br />QUIT<br />OK xxx<br />A response could be “-ERR xxx”, too. The actual specific codes are listed in the RFC.<br />
  21. 21. Email Storage<br />Now that you know the UIDLs for all messages in your box, you can see what messages you already know about.<br />Now, you can pull-down the information for new messages by using the corresponding message-numbers.<br />You can do this using the PHP-IMAP calls imap_fetchheader() and imap_fetchstructure(). These tell you about headers and messages, and messages-within-messages. The imap_fetchstructure() call, however, won’t go very deep into embedded messages.<br />
  22. 22. Email Storage (Notes)<br />To overcome the limits of the limits of the native IMAP extension, webmail apps like Horde will do all IMAP communication directly.<br />
  23. 23. Email Processing<br />It is necessary to process bounces and unsubscription requests.<br />All messages meant for processing should be sent as from a common email-box (this is why the ‘–f’ Sendmail switch to mail() is important).<br />Build a script to do an imap_open() on the mail-box every fifteen minutes or so and scan through the available emails. Delete them afterward.<br />
  24. 24. Email Processing<br />Scan the message contents for trigger words like “unsubscribe” to do something useful.<br />To identify bounces, we need to identify “notification”-type server responses. These should ALWAYS conform to RFC 3463.<br />
  25. 25. Email Processing<br />You can use imap_fetchstructure() to break-down the notification messages. If you find a section having a subtype of ‘DELIVERY-STATUS’, you got one, and you can extract the code by looking for a string like “Status: x.x.x”<br />
  26. 26. Email Processing<br />This code is defined by RFC 822 (?) to indicate the nature of what happened. All true bounces will be classified as a total failure and look like “5.x.x”.<br />Once you know the code, you can proceed to extract a message-ID like ours, or some other customer-identifying data, and then deactivate the customer for mailings immediately.<br />Once you’ve processed everything you’re interested in, delete every message you encounter.<br />
  27. 27. Ad Presentation Concepts<br />Types of Access<br />On a webpage<br />In email: Static ads are generated from templates and then pushed to email. This may implement image maps to link individual buttons in one, big image.<br />
  28. 28. Ad Presentation Concepts<br /> Ads are dynamically built from database rules.<br />Our Ad-Tower technology <br />Will dynamically assemble standard buttons and regularly-rotated images in configurations specific to each client. <br />Overcomes the problem of having to check the image-maps that you have for ads each week by stream-lining the ability of including individual images that are individually wrapped in links automatically.<br />
  29. 29. Ad Presentation Concepts<br />ClickTracker<br />Almost every link for images and buttons refers to our system, which receives the request first before transparently sending the user where they’re expecting to go. This allows us to generate effectiveness-reports for our clients.<br />
  30. 30. Ad Presentation Concepts<br />This also allows us to transparently back-up local files and make sure the location still exists before redirecting there, or else use the backup. The user will never know. This is our PromoCache functionality.<br />
  31. 31. Ad Document Handling<br />A need to cut-up, resize, convert, and merge ad-pages.<br />Dominant Linux utilities<br />Imagemagick: ‘convert’ and ‘mogrify’ (bulk conversion/handling)<br />PDF Toolkit: PDF file manipulation/assembly.<br />
  32. 32. Questions?<br />