<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Sending Email with Attachments from the Command Line</title>
	<atom:link href="http://cuddletech.com/blog/?feed=rss2&#038;p=685" rel="self" type="application/rss+xml" />
	<link>http://cuddletech.com/blog/?p=685&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sending-email-with-attachments-from-the-command-line</link>
	<description>The Blog of Ben Rockwood</description>
	<lastBuildDate>Sat, 18 May 2013 03:46:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: Phil Hollenback</title>
		<link>http://cuddletech.com/blog/?p=685#comment-25791</link>
		<dc:creator>Phil Hollenback</dc:creator>
		<pubDate>Thu, 26 Jan 2012 03:18:43 +0000</pubDate>
		<guid isPermaLink="false">http://cuddletech.com/blog/?p=685#comment-25791</guid>
		<description>So hey I got inspired and turned my reply about using perl into a blog posting:

http://www.hollenback.net/index.php/SendMimeWithPerl

P.</description>
		<content:encoded><![CDATA[<p>So hey I got inspired and turned my reply about using perl into a blog posting:</p>
<p><a href="http://www.hollenback.net/index.php/SendMimeWithPerl" rel="nofollow">http://www.hollenback.net/index.php/SendMimeWithPerl</a></p>
<p>P.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bgall</title>
		<link>http://cuddletech.com/blog/?p=685#comment-25790</link>
		<dc:creator>bgall</dc:creator>
		<pubDate>Wed, 25 Jan 2012 20:31:48 +0000</pubDate>
		<guid isPermaLink="false">http://cuddletech.com/blog/?p=685#comment-25790</guid>
		<description>Take a look at mpack...</description>
		<content:encoded><![CDATA[<p>Take a look at mpack&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Hollenback</title>
		<link>http://cuddletech.com/blog/?p=685#comment-25787</link>
		<dc:creator>Phil Hollenback</dc:creator>
		<pubDate>Mon, 23 Jan 2012 22:09:00 +0000</pubDate>
		<guid isPermaLink="false">http://cuddletech.com/blog/?p=685#comment-25787</guid>
		<description>I would recommend looking at something like the perl module MIME::Lite (http://search.cpan.org/~yves/MIME-Lite-3.01/lib/MIME/Lite.pm).  Two advantages to this approach:

1. Perl is installed on most systems (although the MIME::Lite module probably isn&#039;t be default so you would need to grab it from cpan).

2. This automatically handles niceties like the content-disposition string and base64 encoding so you don&#039;t have to worry about them.

Here&#039;s a minimal script that takes stdin and sends it as a text attachment:

#!/usr/bin/perl -w

use MIME::Lite;

# create a new mime message
$msg = MIME::Lite-&gt;new(
        To      =&gt; $ARGV[0],
        Subject =&gt; $ARGV[1],
        Type    =&gt; &#039;multipart/mixed&#039;
);

# add stdin as a text attachment
$msg-&gt;attach(
        Type    =&gt;&#039;TEXT&#039;,
        FH      =&gt; STDIN
);

# send the message.
$msg-&gt;send;

usage:

cat blah &#124; mmail.pl user@example.com &quot;here&#039;s my stuff&quot;

I tested that out and it produces the desired results.</description>
		<content:encoded><![CDATA[<p>I would recommend looking at something like the perl module MIME::Lite (<a href="http://search.cpan.org/~yves/MIME-Lite-3.01/lib/MIME/Lite.pm" rel="nofollow">http://search.cpan.org/~yves/MIME-Lite-3.01/lib/MIME/Lite.pm</a>).  Two advantages to this approach:</p>
<p>1. Perl is installed on most systems (although the MIME::Lite module probably isn&#8217;t be default so you would need to grab it from cpan).</p>
<p>2. This automatically handles niceties like the content-disposition string and base64 encoding so you don&#8217;t have to worry about them.</p>
<p>Here&#8217;s a minimal script that takes stdin and sends it as a text attachment:</p>
<p>#!/usr/bin/perl -w</p>
<p>use MIME::Lite;</p>
<p># create a new mime message<br />
$msg = MIME::Lite-&gt;new(<br />
        To      =&gt; $ARGV[0],<br />
        Subject =&gt; $ARGV[1],<br />
        Type    =&gt; &#8216;multipart/mixed&#8217;<br />
);</p>
<p># add stdin as a text attachment<br />
$msg-&gt;attach(<br />
        Type    =&gt;&#8217;TEXT&#8217;,<br />
        FH      =&gt; STDIN<br />
);</p>
<p># send the message.<br />
$msg-&gt;send;</p>
<p>usage:</p>
<p>cat blah | mmail.pl <a href="mailto:user@example.com">user@example.com</a> &#8220;here&#8217;s my stuff&#8221;</p>
<p>I tested that out and it produces the desired results.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kj</title>
		<link>http://cuddletech.com/blog/?p=685#comment-25786</link>
		<dc:creator>kj</dc:creator>
		<pubDate>Mon, 23 Jan 2012 18:29:14 +0000</pubDate>
		<guid isPermaLink="false">http://cuddletech.com/blog/?p=685#comment-25786</guid>
		<description>Ben,
You really need to deal with your spam issue. It&#039;s been going on for years, and is ridiculous. 

./kj</description>
		<content:encoded><![CDATA[<p>Ben,<br />
You really need to deal with your spam issue. It&#8217;s been going on for years, and is ridiculous. </p>
<p>./kj</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: risto3</title>
		<link>http://cuddletech.com/blog/?p=685#comment-25778</link>
		<dc:creator>risto3</dc:creator>
		<pubDate>Fri, 20 Jan 2012 05:55:21 +0000</pubDate>
		<guid isPermaLink="false">http://cuddletech.com/blog/?p=685#comment-25778</guid>
		<description>another reference.
http://www.panix.com/~kylet/unix-att.html</description>
		<content:encoded><![CDATA[<p>another reference.<br />
<a href="http://www.panix.com/~kylet/unix-att.html" rel="nofollow">http://www.panix.com/~kylet/unix-att.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: benr</title>
		<link>http://cuddletech.com/blog/?p=685#comment-25775</link>
		<dc:creator>benr</dc:creator>
		<pubDate>Thu, 19 Jan 2012 18:50:43 +0000</pubDate>
		<guid isPermaLink="false">http://cuddletech.com/blog/?p=685#comment-25775</guid>
		<description>uuencode blobs files together, so those aren&#039;t really attachments.  Some mail clients will, as I said, &quot;figure out what you mean&quot; but not all.

Mutt is out for me... I don&#039;t run Linux so mutt isn&#039;t a standard utility, and I personally don&#039;t like installing things I don&#039;t really need.

mpack is a good solution, but like mutt it may or may not be on your system already.  Plus, you don&#039;t get the joy of really understanding how MIME messages are composed.   Its all about the journey of discovery. :)</description>
		<content:encoded><![CDATA[<p>uuencode blobs files together, so those aren&#8217;t really attachments.  Some mail clients will, as I said, &#8220;figure out what you mean&#8221; but not all.</p>
<p>Mutt is out for me&#8230; I don&#8217;t run Linux so mutt isn&#8217;t a standard utility, and I personally don&#8217;t like installing things I don&#8217;t really need.</p>
<p>mpack is a good solution, but like mutt it may or may not be on your system already.  Plus, you don&#8217;t get the joy of really understanding how MIME messages are composed.   Its all about the journey of discovery. <img src='http://cuddletech.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: implicate_order</title>
		<link>http://cuddletech.com/blog/?p=685#comment-25774</link>
		<dc:creator>implicate_order</dc:creator>
		<pubDate>Thu, 19 Jan 2012 18:14:22 +0000</pubDate>
		<guid isPermaLink="false">http://cuddletech.com/blog/?p=685#comment-25774</guid>
		<description>What&#039;s wrong with using the old &quot;uuencode&quot; command and piping it to mail or mailx?

:)

uuencode httpd.conf httpd.conf &#124;mailx -s &quot;test&quot; you@yourmail.com</description>
		<content:encoded><![CDATA[<p>What&#8217;s wrong with using the old &#8220;uuencode&#8221; command and piping it to mail or mailx?</p>
<p> <img src='http://cuddletech.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>uuencode httpd.conf httpd.conf |mailx -s &#8220;test&#8221; <a href="mailto:you@yourmail.com">you@yourmail.com</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ahmed Kamal</title>
		<link>http://cuddletech.com/blog/?p=685#comment-25773</link>
		<dc:creator>Ahmed Kamal</dc:creator>
		<pubDate>Thu, 19 Jan 2012 16:04:14 +0000</pubDate>
		<guid isPermaLink="false">http://cuddletech.com/blog/?p=685#comment-25773</guid>
		<description>mutt -a ?</description>
		<content:encoded><![CDATA[<p>mutt -a ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: j</title>
		<link>http://cuddletech.com/blog/?p=685#comment-25772</link>
		<dc:creator>j</dc:creator>
		<pubDate>Thu, 19 Jan 2012 14:33:48 +0000</pubDate>
		<guid isPermaLink="false">http://cuddletech.com/blog/?p=685#comment-25772</guid>
		<description>I&#039;m in the habit of using mutt on the command line for both Solaris and Linux

$ echo &quot;herp derp&quot; &#124; mutt -a  </description>
		<content:encoded><![CDATA[<p>I&#8217;m in the habit of using mutt on the command line for both Solaris and Linux</p>
<p>$ echo &#8220;herp derp&#8221; | mutt -a</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://cuddletech.com/blog/?p=685#comment-25771</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Thu, 19 Jan 2012 12:16:59 +0000</pubDate>
		<guid isPermaLink="false">http://cuddletech.com/blog/?p=685#comment-25771</guid>
		<description>I have to agree with Jad, mpack makes sending MIME attachments from the command line easy.  I discovered mpack when we found out one of our developers was still using uuencode to send out files.</description>
		<content:encoded><![CDATA[<p>I have to agree with Jad, mpack makes sending MIME attachments from the command line easy.  I discovered mpack when we found out one of our developers was still using uuencode to send out files.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
