http://qs321.pair.com?node_id=191620

Xaositect has asked for the wisdom of the Perl Monks concerning the following question:

I have a recent project that requires a potentially large number of emails to be sent out, each with a unique attachment. (A different text body might be nice, but isn't required) Furthermore, the email itself is HTML with embedded images, and to provide more universal email client support, should have a plain text alternate.

A co-worker and I have spent some time looking through the various perl modules, but we have yet to be able to get one to support all of the above in one email. Netscape 4 seems to be able to send mail that is compatible with just about everything, so we have been using its output as a guideline. I've cleaned it up a little, indented it, and included it at the bottom here.

Mail-Sender apparently either does images/HTML or attachments but not both, (no nesting) MIME-Lite, and MIME-Lite-HTML both looked promising, but a few hours of poking still couldn't get the message formatting the same as that Netscape used.

My co-worker has found a PHP solution which we will be using, but it irks me that we couldn't get it working with Perl. Has anyone encountered a need similar to this? Is it just my inability to get the module working properly? I have a feeling more email-tasks will be coming along in the near future, and I'd like to be ready.

<header stuff> Subject: test Content-Type: multipart/mixed; boundary="------------C5E2B1FC8FFADB6068E11254" X-UIDL: p&+!!8",!!(o4"!Q!]"! This is a multi-part message in MIME format. --------------C5E2B1FC8FFADB6068E11254 Content-Type: multipart/alternative; boundary="------------172AC1BCD76027479338C05A" --------------172AC1BCD76027479338C05A Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit [Image] hi --------------172AC1BCD76027479338C05A Content-Type: multipart/related; boundary="------------C08FD7D2A292CEFA0E9B210D" --------------C08FD7D2A292CEFA0E9B210D Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit <!doctype html public "-//w3c//dtd html 4.0 transitional// +en"> <html> <img SRC="cid:<file>" height=75 width=442> <p>hi</html> --------------C08FD7D2A292CEFA0E9B210D Content-Type: image/gif Content-ID: <file> Content-Transfer-Encoding: base64 Content-Disposition: inline; <filename> <DATA> --------------C08FD7D2A292CEFA0E9B210D-- --------------172AC1BCD76027479338C05A-- --------------C5E2B1FC8FFADB6068E11254 Content-Type: application/pdf; name="cert-noname.pdf" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="cert-noname.pdf" <DATA> --------------C5E2B1FC8FFADB6068E11254--