samedi 14 mars 2015

How to get email attachment MIME type by file extension?


I'm trying to write a class that would use Mandrill APIs to send an email with an attachment. To do that I need to provide MIME type of the attachment for the base-64 encoded attachment contents. The question is how to get it, assuming using the file extension of the attachment?


PS. I was hoping for something better than a long switch/case situation. But if that's my only option, where can I get the most exhaustive list of such associations?




Aucun commentaire:

Enregistrer un commentaire