This is an archival post from my newsletter. Join the newsletter to get in the loop.

HelpSpot Update: Mail integration

Now that we’ve got the general application framework in place, things like authentication, error handling, etc we’re moving on to some of the core functionality. The ability to pull messages in from multiple mailboxes is a primary feature of HelpSpot. We have to reliably pull in messages from multiple mailboxes and then have those messages be posted as requests to the general help desk queue or optionally be assigned directly to a particular person. For example, I may have a mailbox called desktophelp@mycompany.com. Since I know Phil always answers desktop questions I can avoid having messages in this box go in the general help desk queue and instead assign them immediately to Phil. This has a huge impact on response speeds. Not only does the question get to Phil faster, but it’s also one less request the help desk team needs to review and forward.

This sounds fairly easy to do but it gets complicated fast. The mailbox itself might be pop3 or imap, it could be over a secure connection perhaps it’s not always available. We need to write code for all these situations. Once a connection is established the fun really begins. Actually working at this low level with email gives me new found respect for dedicated mail applications like Thunderbird and Outlook. There are just so many pitfalls and possibilities to consider. Of primary concern are determining if the message body is HTML or text, are there attachments, if there are attachments what mime type are they, are they nested, are there inline mime objects as well, etc. Whew.

As I mentioned the other day, PHP could use a little more abstraction in this area. The IMAP extension which handles all this stuff works reliably but it still leaves you with alot of code to write to implement these things and since almost everyone working with mail wants to do the same things it would be better done if pushed down into the C library. Anyway, I’ll leave you with a sample of the code you would need to pull out email with attachments in ColdFusion:



<cfpop server="mail.company.com"
username=#myusername#
password=#mypassword#
action="GetAll"
attachmentpath="c:tempattachments"
name="Sample">

Join my mailing list

Join my mailing list and get a copy of my ebook, Securing the Five Figure Sale, for free. Instantly.