<<< Date Index >>>     <<< Thread Index >>>

Re: mutt/2147: Unbale to see the image as a part of email message body - mutt with -i option



The following reply was made to PR mutt/2147; it has been noted by GNATS.

From: Moritz Barsnick <moritz+mutt@xxxxxxxxxxxx>
To: bug-any@xxxxxxxxxxxxx
Cc: Raj <jagtapr@xxxxxxxxx>
Subject: Re: mutt/2147: Unbale to see the image as a part of email message body 
- mutt with -i option
Date: Wed, 14 Dec 2005 18:12:22 +0100

 [Cc:ing to Raj for readability, as the BTS->mutt-dev make break some
 things.]
 
 Hi,
 
 On Sat, Dec 10, 2005 at 07:35:01 +0100, TAKAHASHI Tamotsu wrote:
 >  HTML messages use ``<img src="cid:foobar">'' to show images,
 >  but ``grep -i content-id ~/mutt/*.c'' returns nothing.
 
 I think it's sufficient to attach an image
 (Content-Disposition: attachment; filename="1.jpg")
 and refer to that image with the HTML <IMG SRC="1.jpg"> tag. At least
 for Outlook.
 
 >  We can modify Content-Type and Content-Description with mutt,
 >  but mutt has no function to modify/create Content-Id.
 
 Can this (the former) be done from mutt's command line? I couldn't
 achieve it, and it seems such an HTML needs a few more quirks than just
 Content-Type.
 
 >  If you write a sendmail-wrapper to
 >   * add a CID to each attachments
 >   * and s/attach1/cid:<the-CID-of-the-first-attachment>/,
 >  you can use ``<img src="attach1">'' to send HTML messages.
 
 As a "POC" (proof of concept), I wrote this one line wrapper. It needs
 mimencode for the base64 though, and required me to do some fiddling
 with headers and boundaries - something mutt is much better at.  ;-)
 
 Here comes the really long line (feel free to hack it into a script
 with parameters). I broke it at the '\$' places for readability:
 
 ( echo -e 'From: my_email\nTo: recipient@xxxxxxxxxx\n\
 Subject: embedded image test\n\
 Content-Type: multipart/mixed; boundary="bound"\n\n\n\
 --bound\nContent-Type: text/html; charset=us-ascii\n\
 Content-Disposition: inline\n\n\
 <HTML><IMG SRC="1.jpg"></HTML>\n--bound\n\
 Content-Type: image/jpeg\n\
 Content-Disposition: attachment; filename="1.jpg"\n\
 Content-Transfer-Encoding: base64\n'; \
 mimencode <the_image.jpg; echo -e '\n--bound--\n' ) | \
 sendmail -oi -t -v
 
 Only flaw: 
 The image will display inline _and_ be presented as an attachment in
 Outlook...
 
 HTH,
 Moritz