<?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>Manitou-Mail Blog &#187; manitou-mdx</title>
	<atom:link href="http://www.manitou-mail.org/blog/tag/manitou-mdx/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.manitou-mail.org/blog</link>
	<description>on the use and development of the Manitou-Mail program</description>
	<lastBuildDate>Mon, 23 Aug 2010 19:50:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Routing outgoing mail in manitou-mdx</title>
		<link>http://www.manitou-mail.org/blog/2009/10/routing-outgoing-mail-in-manitou-mdx/</link>
		<comments>http://www.manitou-mail.org/blog/2009/10/routing-outgoing-mail-in-manitou-mdx/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 21:25:14 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Usage]]></category>
		<category><![CDATA[manitou-mdx]]></category>

		<guid isPermaLink="false">http://www.manitou-mail.org/blog/?p=111</guid>
		<description><![CDATA[<p>The default command invoked as the delivery agent for manitou-mdx is `sendmail -f $FROM$ -t` where $FROM$ is replaced by the sender&#8217;s email address,  which matches whats is called the sender&#8217;s identity in Manitou-Mail. On a typical Unix system, this command generally corresponds to the Mail Submission Agent that is installed and responsible for [...]]]></description>
			<content:encoded><![CDATA[<p>The default command invoked as the delivery agent for manitou-mdx is `<code>sendmail -f $FROM$ -t</code>` where $FROM$ is replaced by the sender&#8217;s email address,  which matches whats is called the sender&#8217;s identity in Manitou-Mail. On a typical Unix system, this command generally corresponds to the <a href="http://en.wikipedia.org/wiki/Mail_submission_agent">Mail Submission Agent</a> that is installed and responsible for routing the outgoing messages. The sendmail name doesn&#8217;t necessarily imply that the MSA is the <a href="http://www.sendmail.org">sendmail SMTP server</a> itself, it can be <a href="http://www.postfix.org">postfix</a>, or <a href="http://www.exim.org">exim</a>, or <a href="http://esmtp.sourceforge.net">esmtp</a>, or other programs that have adopted the same name and command line arguments for historical reasons and for the sake of interoperability.<br />
Anyway in manitou-mdx, if this default command is not suitable, the administrator can replace it either globally, or per sender&#8217;s identity. A sender&#8217;s identity is declared in manitou-mdx configuration file by simply declaring a mailbox with its email address. In the Manitou-Mail user interface, the sender&#8217;s identities are configured in the preferences and choosed in the composer.</p>
<p>A typical reason to use different delivery agents when using different identities is that messages may have to be routed to different SMTP servers with different authorization methods. For example, some servers will simply reject messages that have an unexpected From address.<br />
Also there are other cases such as messages from a GMail address that should be routed to a Google SMTP server in order to be signed with a proper <a href="http://www.dkim.org/">DomainKeys</a> header field.<br />
Indeed, while it&#8217;s not mandatory, some receivers may pre-sort as spam or reject messages from GMail addresses that are not signed as the Google SMTP servers do with a DomainKey signature (not trusing these messages being the point of DKIM). Let&#8217;s see how to route messages written in Manitou-Mail from a GMail address to Google SMTP servers.<br />
I&#8217;ve used <a href="http://msmtp.sourceforge.net">msmtp</a> for a simple, easy to configure Mail Submission Agent. <a href="http://esmtp.sourceforge.net/">esmtp </a>is also a candidate but its debian package makes it an alternative to postfix and I happen to want it to supplement postfix, not replace it. msmtp, on the other hand, is a supplementary package that doesn&#8217;t conflict with the default MSA.</p>
<p>The procedure to use msmtp is quite simple:<br />
Create a $HOME/.certs directory if none already exists.<br />
Create a $HOME/.msmtprc file (with perm 0600) containing:<br />
<code><br />
# gmail account<br />
auth on<br />
host smtp.gmail.com<br />
port 587<br />
user USERNAME@gmail.com<br />
password XXXXXX<br />
from USERNAME@gmail.com<br />
tls on<br />
tls_trust_file /home/daniel/.cert/ThawtePremiumServerCA.crt<br />
</code><br />
Obviously USERNAME is to be replaced by your GMail login.<br />
The cert file is to be extracted from the set of Thawte certificates available at: <a href="https://www.verisign.com/support/thawte-roots.zip">https://www.verisign.com/support/thawte-roots.zip</a>, with this command:<br />
<code><br />
unzip -p thawte-roots.zip 'Thawte SSLWeb Server Roots/thawte Premium Server CA/Thawte Premium Server CA.pem' &gt; ~/.certs/ThawtePremiumServerCA.crt<br />
</code></p>
<p>And in manitou-mdx&#8217;s configuration file, we have something like:<br />
<code><br />
[common]<br />
# various things<br />
[USERNAME@gmail.com]<br />
local_delivery_agent = msmtp -f $FROM$ -t<br />
</code></p>
<h3><strong><strong>UPDATE</strong></strong>:</h3>
<p>the mentioned certificate is no longer accepted, now we should use Equifax_Secure_CA.crt. I located the file in the debian package named &#8220;ca-certificates&#8221;, so changing my .smtprc to:</p>
<p><code>tls_trust_file /usr/share/ca-certificates/mozilla/Equifax_Secure_CA.crt<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.manitou-mail.org/blog/2009/10/routing-outgoing-mail-in-manitou-mdx/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Indexing HTML parts</title>
		<link>http://www.manitou-mail.org/blog/2009/08/indexing-html-parts/</link>
		<comments>http://www.manitou-mail.org/blog/2009/08/indexing-html-parts/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 13:12:44 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[manitou-mdx]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://www.manitou-mail.org/blog/?p=3</guid>
		<description><![CDATA[<p>While HTML integration is improving in Manitou-Mail, the current version (0.9.12) does not index the contents of HTML parts. This is generally not a problem because messages tend to carry a text version inside a multipart/alternative MIME construct, and that version gets indexed so that the message can still be retrieved by the words it [...]]]></description>
			<content:encoded><![CDATA[<p>While HTML integration is improving in Manitou-Mail, the current version (0.9.12) does not index the contents of HTML parts. This is generally not a problem because messages tend to carry a text version inside a multipart/alternative MIME construct, and that version gets indexed so that the message can still be retrieved by the words it contains. But still, some people send HTML-only messages, in which case we want to automatically extract the text from the HTML and pass it to the indexer.</p>
<p>It&#8217;s relatively easy to write a manitou-mdx Perl plugin that does just that, by using a CPAN module to do the HTML to text conversion: <a href="http://search.cpan.org/~sburke/HTML-Format-2.04/lib/HTML/FormatText.pm">HTML::FormatText</a></p>
<p>Apart from the usual <strong>init</strong> and <strong>process</strong> functions that are described in the <a href="http://www.manitou-mail.org/mdx/plugins-reference.html">mdx plugins reference</a>, we need to provide two functions: one that recursively descends the MIME tree to find the html parts, and another that extracts them to text and pass them to the indexer.</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">sub</span> index_contents <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$fh</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$ctxt</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$html</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$text</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">local</span> <span style="color: #0000ff;">$/</span><span style="color: #339933;">;</span>
    <span style="color: #0000ff;">$html</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$fh</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">getline</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">defined</span> <span style="color: #0000ff;">$html</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$tree</span> <span style="color: #339933;">=</span> HTML<span style="color: #339933;">::</span><span style="color: #006600;">TreeBuilder</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">new</span><span style="color: #339933;">;</span>
    <span style="color: #0000ff;">$tree</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">parse_content</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$html</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$formatter</span> <span style="color: #339933;">=</span> HTML<span style="color: #339933;">::</span><span style="color: #006600;">FormatText</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">new</span><span style="color: #009900;">&#40;</span>leftmargin<span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> rightmargin<span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">78</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #0000ff;">$text</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$formatter</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">format</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$tree</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">defined</span> <span style="color: #0000ff;">$text</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    Manitou<span style="color: #339933;">::</span><span style="color: #006600;">Words</span><span style="color: #339933;">::</span><span style="color: #006600;">index_words</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$ctxt</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'dbh'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$ctxt</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'mail_id'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">\$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> process_parts <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$obj</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$ctxt</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">is_multipart</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$subobj</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">parts</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      process_parts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$subobj</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$ctxt</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    <span style="color: #666666; font-style: italic;"># recurse</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$type</span><span style="color: #339933;">=</span><span style="color: #0000ff;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">effective_type</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$type</span> <span style="color: #b1b100;">eq</span> <span style="color: #ff0000;">&quot;text/html&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$io</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">bodyhandle</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">open</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;r&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      index_contents<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$io</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$ctxt</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #0000ff;">$io</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">close</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The full source code and download link are available on the <a href="http://www.manitou-mail.org/wiki/doku.php/plugins:html_indexer">wiki</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.manitou-mail.org/blog/2009/08/indexing-html-parts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
