[oak perl] MIME::Lite question
Eli the Bearded
oaklandpm at eli.users.panix.com
Thu Jun 2 11:16:27 PDT 2005
Mike Lewis <cajun at cajuninc.com> wrote:
> The message is being sent as HTML, however the two images do not appear.
> I've tried adding other attachments for the two images, but that just
> makes them appear as attachments (duh..) rather than in the HTML
> document.
>
> Obviously I have missed the boat here somewhere. Suggestions welcome.
A mere "does not appear" doesn't really help. Are the images not in
the MIME output at all? Or is it that the HTML portion does not find
the images?
I come from this as someone who has very little experience using MIME
generators (and none with MIME::Lite), but a fair amount of MIME
parsing experience. I don't know how to do what you want with that
module, and I don't know if there is a better one. I *do* know what
the MIME output should look like.
Normal: mail
Headers: and such
MIME-Version: 1.0 (flag that this is a MIME message)
Content-Type: multipart/related (these things go together);
boundary="-->8--cut-here--"
This is the message preamble. Only non-MIME readers get to see this.
---->8--cut-here--
Content-Type: text/html; charset="us-ascii" (always set your charset)
<html><head><title>You've Got MIME!</title></head>
<body><h1>You've Got MIME!</h1>
<p>An image here:
<img src="cid:our-image-content-id" alt="arrow" width=42 height=29 />
</p>
</body>
</html>
---->8--cut-here--
Content-Type: image/gif; name="arrow.gif" (name is optional)
Content-Disposition: inline; filename="arrow.gif" (can't remember if
this header is needed or not)
Content-ID: <our-image-content-id>
Content-Transfer-Encoding: base64
R0lGODdhKgAdAIAAAAAAAP///ywAAAAAKgAdAAACK4yPqcvtD6OctNqL
s968+w+G4kiWBwCYCKqeqYLGItsmdI3n+s73/g8MYgoAOw==
---->8--cut-here----
This is the message epilogue. Non-MIME readers can see this, but they
probably have given up by now.
I just whipped that up by hand, so it might have a mistake or two in it.
Important, though, are the URI format used in the <IMG> tag, and the
matching content-ID on the appropriate related part.
Note that it is perfectly legit to do multipart/alternative with a
plain text part and a multipart/related alternative. MIME allows
plenty of recursion, just like RFC-822 (comments (allow (recusion))).
Such nesting might be beyond the scope of a module named "Lite"
however. Be nice to your readers and follow the guideline of sorting
parts so the plainest stuff comes first. It irks me to get alternative
messages with the html first and the plaintext last.
Elijah
More information about the Oakland
mailing list