


<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CantRemembrances &#187; gmail</title>
	<atom:link href="http://blog.cantremember.com/tag/gmail/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.cantremember.com</link>
	<description>Memes of a technical vein discovered during CantRemember.com implementation</description>
	<lastBuildDate>Tue, 16 Feb 2010 06:36:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Easy delivery with mstmp and GMail</title>
		<link>http://blog.cantremember.com/easy-delivery-with-mstmp-and-gmail/</link>
		<comments>http://blog.cantremember.com/easy-delivery-with-mstmp-and-gmail/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 02:00:57 +0000</pubDate>
		<dc:creator>dfoley</dc:creator>
				<category><![CDATA[Site]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[msmtp]]></category>

		<guid isPermaLink="false">http://blog.cantremember.com/?p=64</guid>
		<description><![CDATA[At the moment, I really don&#8217;t feel like setting up a full-fledged MTA such as sendmail, postfix or qmail.  I want to take the simple course, basically because I&#8217;m lazy.  Fortunately, there are a variety of simple SMTP &#8216;relays&#8217; out there such as ssmtp and esmtp.  Some network officianatos may consider this [...]]]></description>
			<content:encoded><![CDATA[<p>At the moment, I really don&#8217;t feel like setting up a full-fledged MTA such as <a href="http://www.sendmail.org/">sendmail</a>, <a href="http://www.postfix.org/">postfix</a> or <a href="http://www.qmail.org/top.html">qmail</a>.  I want to take the simple course, basically because I&#8217;m lazy.  Fortunately, there are a variety of simple SMTP &#8216;relays&#8217; out there such as <a href="http://packages.debian.org/unstable/mail/ssmtp">ssmtp</a> and <a href="http://esmtp.sourceforge.net/">esmtp</a>.  Some network officianatos may consider this to be re-inventing the wheel, but then again, I&#8217;m sure glad that my car doesn&#8217;t roll on stone cylinders.</p>
<p>After some consideration, I chose to go with <a href="http://msmtp.sourceforge.net/"><strong>msmtp</strong></a>.  I like its flexible configuration, and it&#8217;s just the right size for the job (with room to grow).  The major thing I was looking for was STARTTLS support.  I wasn&#8217;t so concerned with the trust files and certificates, I just had a need to support GMail&#8217;s minimum requirements.  Yes, msmtp gives you that <em>and</em> the whole 9 yards, for when I need them all.</p>
<h3>msmtp Configuration for GMail</h3>
<p>With a combination of their official <a href="http://msmtp.sourceforge.net/doc/msmtprc.txt">configuration example</a> plus a few targeted suggestions from <a href="http://greybeardedgeek.net/?p=17">Grey Bearded Geek&#8217;s take at ssmtp</a>, I came up with the following:</p>
<div class="pre_wrap">
<pre><code># Set default values for all following accounts.
defaults

host  smtp.gmail.com
port  587
timeout  off
protocol  smtp
domain  localhost

# /usr/bin/msmtp --version
#  plain cram-md5 digest-md5 gssapi external login ntlm
auth  on
user  <strong>GMAIL-USER</strong>
password  <strong>GMAIL-PASSWD</strong>

tls  on
tls_starttls  on
# WARNING: When the checks are disabled, TLS/SSL sessions will be vulnerable to man-in-the-middle attacks
tls_certcheck  off

logfile  /var/log/msmtp.log
###syslog  on

# A system wide configuration is optional.
# If it exists, it usually defines a default account.
# This allows msmtp to be used like /usr/sbin/sendmail.
account default

# Construct envelope-from addresses of the form "user@oursite.example".
###auto_from on
from  <strong>USER@DOMAIN</strong>
maildomain  <strong>DOMAIN</strong></code></pre>
</div>
<p>You plop in the <code>GMAIL-USER</code> and <code>GMAIL-PASSWD</code>, and you&#8217;re good to go.</p>
<h3>Custom From: Address</h3>
<p>I soon learned that the <code>from</code> and <code>maildomain</code> settings are irrelevant; Google <a href="http://stackoverflow.com/questions/109520/rails-and-gmail-smtp-how-to-use-a-custom-from-address">will not arbitrarily change</a> the <code>From:</code> header of your mail.  That makes sense.  So the mail will appear as if it&#8217;s coming from you, <em>personally</em>.  Well, it turns out that there&#8217;s a few things you can do to get around that.</p>
<ul>
<li>Create yourself a <em>dedicated GMail account</em>.  Now you have isolated your soon-to-be-wildly-popular start-up&#8217;s e-mail account from your personal one.</li>
<li>Follow the instructions on <a href="http://mail.google.com/support/bin/answer.py?ctx=gmail&amp;hl=en&amp;answer=22370">adding a custom From: address to your account</a>.  I had to use the older version of the GMail interface to do so.  Google will verify that you own the address &#8212; you&#8217;d better be able to receive mail at that address &#8212; and then you can make it your default.
<p>GMail will now send your mail as it were coming from that address, but it will do so without providing an alias.</li>
<li>When sending your outbound mail, you can include the following headers:
<div class="pre_wrap">
<pre><code>From:  <strong>ALIAS</strong>
Reply-To:  <strong>ALIAS &lt;USER@DOMAIN</strong>&gt;</code></pre>
</div>
<p>Google will respect the <code>ALIAS</code> portion of the <code>From:</code> address, though not the address <em>itself</em>.  The <code>Reply-To:</code> is optional, but respected in its entirety (alias and address).</li>
</ul>
<p>Works like a charm.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cantremember.com/easy-delivery-with-mstmp-and-gmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
