[svlug] HTML mail from the commandline
Jesse Monroy
jesse650 at gmail.com
Sun Dec 21 16:41:13 PST 2014
Hi Akkana,
on our request I can tell you I was working on something similar.
At the time I was running my book business an was looking for
a way to automate a few processes, including requests for
visual confirmation on certain titles.
As such, here are a few clues. I did not have a full solution, nor
did I complete one. I looked for some, and the best I could do
was find random implementations in Perl or Python. In the end
python seemed to have superior tools, but I used TCL/TK for
stream my data between programs.
#1 You'll need a way to create Multi-part MIME headers and wrappers.
a) the header typically goes in the mail header (vs. the body),
but the header could also go in the body, but I don't know
how that work, but I see it all the time.
b) the wrapper will be used to wrap the payload, whether it's
HTML or a binary image
#2 You'll a encoder for binaries, and for files that have line longer
than 72 characters in length (base64 encoding seems most popular)
In short, the mail agents are made aware that the mail has a MIME type
(via the header). The mail reader is made aware, again via the header,
then again in the body.
Lastly, I recommend getting a gmail account and reverse engineer it.
The psuedo-mail below comes from google. Also, use the "basic HTML"
mail, no the standard. Then on the top right you'll see "show original"
that will show you a real live production version of email
Jesse
Your mail should look something like this:
MIME-Version: 1.0
Received: by XX.XXX.XXX.X with HTTP; Tue, 16 Dec 2014 02:32:19 -0800 (PST)
Date: Tue, 16 Dec 2014 02:32:19 -0800
Delivered-To: jesse650 at gmail.com
Message-ID: <GOOGLESMAILID at mail.gmail.com>
Subject:
From: Jesse Monroy <jesse650 at gmail.com>
To: jesse650 at gmail.com
Content-Type: multipart/mixed; boundary=001a113a7d84aa5d6a050a52df9d
--001a113a7d84aa5d6a050a52df9d
Content-Type: multipart/alternative; boundary=001a113a7d84aa5d63050a52df9b
--001a113a7d84aa5d63050a52df9b
Content-Type: text/plain; charset=UTF-8
--001a113a7d8NOTAREALMIMEHEADER
Content-Type: text/html; charset=UTF-8
--001a113a7d8NOTAREALMIMEHEADER--
--001a113a7d8junkjunkjunkjunkd
Content-Type: text/x-vcard; charset=US-ASCII; name="00001.vcf"
Content-Disposition: attachment; filename="00001.vcf"
Content-Transfer-Encoding: base64
X-Attachment-Id: 1487641964479250432-local0
QkVHSU46VkNBUkQNClZFUlNJT046Mi4xDQpOOjtXYWRlOzs7DQpGTjpXYWRlDQpURUw7Q0VMTDox
...
...
--001a113a7d8junkjunkjunkjunkd--
On 12/21/14, Akkana Peck <akkana at shallowsky.com> wrote:
> This is going to sound like a strange question, but do any of you
> mutt/pine/etc users know of a way to send HTML mail with images?
>
> I'm a mutt user, and 99.999% of the time I'm happy sending plaintext
> mail. But once in a blue moon, I want to send an HTML message with
> embedded images. I can write up the HTML and preview it in a
> browser, but I don't know of a way of emailing it.
>
> I've tried a handful of ways of sending HTML from mutt, attaching
> the HTML and images and editing the attachment list in various ways,
> but when I send them to my husband's Mac they all look like a blank
> message with an HTML attachment (yes, even though there were no
> plaintext parts of the message), not a message with inline images.
>
> I'd rather not have to configure a full GUI mailer, setting up SMTP
> server, giving it a dummy POP/IMAP server, and letting it set up a
> local folder store I'll never use, all to send one message.
>
> Is there a standalone Linux program that can do this? Or a GUI
> mailer that can send a message without needing a lot of configuration
> besides the outgoing SMTP server?
>
> ...Akkana
>
> _______________________________________________
> svlug mailing list
> svlug at lists.svlug.org
> http://lists.svlug.org/lists/listinfo/svlug
>
More information about the svlug
mailing list