<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/assets/rss.xsl" type="text/xsl"?><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>Sacha Chua - tag - mail</title>
	<atom:link href="https://sachachua.com/blog/tag/mail/feed/index.xml" rel="self" type="application/rss+xml" />
	<atom:link href="https://sachachua.com/blog/tag/mail" rel="alternate" type="text/html" />
	<link>https://sachachua.com/blog/tag/mail/feed/index.xml</link>
	<description>Emacs, sketches, and life</description>
	<lastBuildDate>Mon, 06 Apr 2026 14:36:57 GMT</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>daily</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>11ty</generator>
  <item>
		<title>Setting e-mail expectations: Roughly once a week</title>
		<link>https://sachachua.com/blog/2013/07/setting-e-mail-expectations-roughly-once-a-week/</link>
		<dc:creator><![CDATA[Sacha Chua]]></dc:creator>
		<pubDate>Sun, 21 Jul 2013 12:00:00 GMT</pubDate>
    <category>communication</category>
<category>connecting</category>
		<guid isPermaLink="false">https://sachachua.com/blog/?p=25301</guid>
		<description><![CDATA[<p><strong><a href="https://sachachua.com/blog/wp-content/uploads/2013/07/hamster-wheel.png"><img loading="lazy" title="hamster-wheel" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; float: right; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="hamster-wheel" align="right" src="https://sachachua.com/blog/wp-content/uploads/2013/07/hamster-wheel_thumb.png" width="200" height="137"></a>I’ve seen the e-mail hamster-wheel that other people are stuck on, and I don’t want to go there. </strong>As for me, e-mail doesn’t make me feel important or needed or valued. E-mail is… well… it’s conversations that are hidden from the world, thoughts that I’m going to forget because no one else is going to come across them in a search engine and post comments. As lots of people have observed (including Luis Suarez, whom I knew at IBM): “E-mail is where knowledge goes to die.”</p>
<p><strong>Still, e-mail is useful. </strong>I keep e-mail for following up with clients, coordinating with W- or with meetup organizers, introducing people, handling quick tech support for my mom, and answering the occasional private question that usually doesn’t have to be private anyway. I like getting quick questions, especially if I can send people links (although getting those questions as public comments works even better!). I like getting in-depth questions too, which I try to answer in blog posts whenever possible, add a note to my <a href="https://dl.dropboxusercontent.com/u/3968124/sharing/index.html">outline</a> with the name of the person requesting it.</p>
<p><strong>I reply to e-mail roughly once a week, </strong>although I check it more often to see if there’s anything that needs attention. Here’s how I work. Maybe you’ll pick up some ideas or tips! =)</p>
<p><strong>I use my phone to quickly check e-mail </strong>while I’m walking or waiting. I get a lot of e-mail that I don’t particularly care about, even though I periodically unsubscribe from lists. The phone’s limited interface means that I generally don’t use it to reply to e-mail (unless I can say what I need in one or two sentences with no links), but I can delete unneeded messages and add stars to messages that need action.</p>
<p><strong>Friday is my “catch up” day. </strong>I balance my company books, follow up on tasks I’m waiting for, and go through my e-mail, writing blog posts (like this one!) and e-mailing replies. The <a href="http://wordpress.org/plugins/shareadraft/">Share a Draft</a> plugin for WordPress helps here because I can keep my ~1-post-a-day schedule while still giving people a sneak preview of any upcoming blog posts related to their question.</p>
<p><strong>If there are important conversations I need to follow up on, I use </strong><a href="http://www.boomeranggmail.com/"><strong>Boomerang for Gmail</strong></a><strong>. </strong>This archives the message for now, returning it to my inbox in case I haven’t received a reply within the specified timeframe. I also use Boomerang for Gmail’s “Send Later” feature to schedule e-mails so that I don’t have to set a reminder.</p>
<p><strong>There are lots of other ways that people handle e-mail.</strong> There’s the idea of “Touch it once” – check mail only when you’re ready to handle it, and move important information to your to-do list. That would probably mean checking it more frequently, though, and I don’t want to commit time every day to do that. There’s being strict about checking only at specified times (such as once a day, or even once a week) and always having an Out of Office message turned on or putting that in your signature, but that felt odd too.&#160; So here we are – I check mail frequently, respond occasionally, and try to move things into blog posts as much as possible.</p>
<p>There are trade-offs for my approach, of course. I could probably drum up more business and build more connections if I had a reputation for being instantly responsive… but I wouldn’t want to be shackled to my e-mail and I wouldn’t want my task list to be rearranged with every incoming message, so I’m fine with what I have.</p>
<p>Also, if it takes you a few weeks to reply too, no need to apologize. Almost all of my mail isn’t time-sensitive, and if it’s important to me, I’ll indicate the date I need a response by and I’ll follow up if time has passed.</p>
<p>E-mail doesn’t have to be a slave-driver. =)</p>

<p>You can <a href="https://sachachua.com/blog/2013/07/setting-e-mail-expectations-roughly-once-a-week/#comment">view 3 comments</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2013%2F07%2Fsetting-e-mail-expectations-roughly-once-a-week%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></description>
		</item><item>
		<title>Analyzing my Lotus Notes sent mail since January 2011</title>
		<link>https://sachachua.com/blog/2012/02/analyzing-my-lotus-notes-sent-mail-since-2011-01/</link>
		<dc:creator><![CDATA[Sacha Chua]]></dc:creator>
		<pubDate>Thu, 16 Feb 2012 19:37:09 GMT</pubDate>
    <category>visualization</category>
<category>analysis</category>
<category>ibm</category>
<category>lotus</category>
		<guid isPermaLink="false">https://sachachua.com/blog/?p=23164</guid>
		<description><![CDATA[<p>Today is my penultimate day at IBM! Having successfully turned my projects over to another developer (hooray for the habit of organizing project-related files in Lotus Connections Activities), I’ve been focusing on getting things ready for the traditional goodbye e-mail, which I plan to send tomorrow.</p>
<p>I dug around in the Lotus Connections Profiles API to see if I could get a list of my contacts’ e-mail addresses. I fixed a small bug in the feed exporter of the Community Toolkit (<a href="http://w4.ibm.com/community">w4.ibm.com/community</a> for people in the IBM intranet) and exported my contacts, giving me a list of 530 IBMers who had accepted or sent me an invitation to connect.</p>
<p>Not everyone participates in that Web 2.0 network, though, so I wanted to analyze my sent mail to identify other people to whom I should send a note. I couldn’t find a neat LotusScript to do the job, and I couldn’t get the <a href="http://tech.niques.info/projects/lotus-notes-email-export/">NSF to EML or mbox converter</a> to work. Because I didn’t need all the information, just the recipients, subjects, and times, I wrote my own script (included at the end of this blog post).</p>
<p>I used the script to summarize the messages in my sent mail folder, and crunched the numbers using PivotTables in Microsoft Excel. I worked with monthly batches so that it was easier to find and fix errors. I decided to analyze all the mail going back to the beginning of last year in order to identify the people I mailed the most frequently, and to come up with some easy statistics as well. </p>
<p><a href="https://sachachua.com/blog/wp-content/uploads/2012/02/image1.png"><img loading="lazy" style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://sachachua.com/blog/wp-content/uploads/2012/02/image_thumb1.png" width="580" height="397"></a></p>
<p>Spiky around project starts/ends, I’d guess.</p>
<p><a href="https://sachachua.com/blog/wp-content/uploads/2012/02/image2.png"><img loading="lazy" style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://sachachua.com/blog/wp-content/uploads/2012/02/image_thumb2.png" width="580" height="397"></a></p>
<p>I wanted to see which roles I tended to e-mail often, so I categorized each recipient with their role. I distinguished between people I’d worked with directly on projects (coworkers) and people who worked with IBM but with whom I didn’t work on a project (colleagues). The numbers below count individual recipients.</p>
<table style="line-height: normal; border-collapse: collapse" border="0" cellspacing="0" cellpadding="0" width="564">
<colgroup>
<col style="width: 72pt; mso-width-source: userset; mso-width-alt: 3510" width="96">
<col style="width: 82pt; mso-width-source: userset; mso-width-alt: 3986" width="109">
<col style="width: 156pt; mso-width-source: userset; mso-width-alt: 7606" width="208">
<col style="width: 154pt; mso-width-source: userset; mso-width-alt: 7497" width="205"></colgroup>
<tbody>
<tr style="height: 12.75pt" height="17">
<td style="border-left: black 0.5pt solid; vertical-align: bottom; border-top: black 0.5pt solid" class="xl24" height="17" width="96"><font face="Arial"></font><font style="font-size: 10pt" color="#000000"><strong>Role</strong></font></td>
<td style="border-left: black 0.5pt solid; vertical-align: bottom; border-top: black 0.5pt solid" class="xl24" width="136">
<p align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000"><strong>Number of people</strong></font></p>
</td>
<td style="vertical-align: bottom; border-top: black 0.5pt solid; border-right: black 0.5pt solid" class="xl27" width="181">
<p align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000"><strong>Number of individual                  <br>e-mails sent</strong></font></p>
</td>
<td style="vertical-align: bottom" width="149">
<p align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000"><strong>Average e-mails sent                  <br>per person</strong></font></p>
</td>
</tr>
<tr style="height: 12.75pt" height="17">
<td style="border-left: black 0.5pt solid; vertical-align: bottom; border-top: black 0.5pt solid" class="xl24" height="17"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">colleague</font></td>
<td style="border-left: black 0.5pt solid; vertical-align: bottom; border-top: black 0.5pt solid" class="xl24" width="136" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">407</font></td>
<td style="vertical-align: bottom; border-top: black 0.5pt solid; border-right: black 0.5pt solid" class="xl27" width="181" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">827</font></td>
<td style="vertical-align: bottom" class="xl30" width="149" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">2.0</font></td>
</tr>
<tr style="height: 12.75pt" height="17">
<td style="border-left: black 0.5pt solid; vertical-align: bottom" class="xl25" height="17"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">coworker</font></td>
<td style="border-left: black 0.5pt solid; vertical-align: bottom" class="xl25" width="136" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">50</font></td>
<td style="vertical-align: bottom; border-right: black 0.5pt solid" class="xl28" width="181" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">562</font></td>
<td style="vertical-align: bottom" class="xl30" width="149" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">11.2</font></td>
</tr>
<tr style="height: 12.75pt" height="17">
<td style="border-left: black 0.5pt solid; vertical-align: bottom" class="xl25" height="17"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">client</font></td>
<td style="border-left: black 0.5pt solid; vertical-align: bottom" class="xl25" width="136" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">21</font></td>
<td style="vertical-align: bottom; border-right: black 0.5pt solid" class="xl28" width="181" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">387</font></td>
<td style="vertical-align: bottom" class="xl30" width="149" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">18.4</font></td>
</tr>
<tr style="height: 12.75pt" height="17">
<td style="border-left: black 0.5pt solid; vertical-align: bottom" class="xl25" height="17"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">manager</font></td>
<td style="border-left: black 0.5pt solid; vertical-align: bottom" class="xl25" width="136" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">4</font></td>
<td style="vertical-align: bottom; border-right: black 0.5pt solid" class="xl28" width="181" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">109</font></td>
<td style="vertical-align: bottom" class="xl30" width="149" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">27.3</font></td>
</tr>
<tr style="height: 12.75pt" height="17">
<td style="border-left: black 0.5pt solid; vertical-align: bottom" class="xl25" height="17"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">partner</font></td>
<td style="border-left: black 0.5pt solid; vertical-align: bottom" class="xl25" width="136" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">9</font></td>
<td style="vertical-align: bottom; border-right: black 0.5pt solid" class="xl28" width="181" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">51</font></td>
<td style="vertical-align: bottom" class="xl30" width="149" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">5.7</font></td>
</tr>
<tr style="height: 12.75pt" height="17">
<td style="border-left: black 0.5pt solid; vertical-align: bottom" class="xl25" height="17"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">system</font></td>
<td style="border-left: black 0.5pt solid; vertical-align: bottom" class="xl25" width="136" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">9</font></td>
<td style="vertical-align: bottom; border-right: black 0.5pt solid" class="xl28" width="181" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">21</font></td>
<td style="vertical-align: bottom" class="xl30" width="149" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">2.3</font></td>
</tr>
<tr style="height: 12.75pt" height="17">
<td style="border-left: black 0.5pt solid; vertical-align: bottom" class="xl25" height="17"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">other</font></td>
<td style="border-left: black 0.5pt solid; vertical-align: bottom" class="xl25" width="136" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">8</font></td>
<td style="vertical-align: bottom; border-right: black 0.5pt solid" class="xl28" width="181" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">11</font></td>
<td style="vertical-align: bottom" class="xl30" width="149" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">1.4</font></td>
</tr>
<tr style="height: 12.75pt" height="17">
<td style="border-left: black 0.5pt solid; vertical-align: bottom" class="xl25" height="17"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">self</font></td>
<td style="border-left: black 0.5pt solid; vertical-align: bottom" class="xl25" width="136" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">1</font></td>
<td style="vertical-align: bottom; border-right: black 0.5pt solid" class="xl28" width="181" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">5</font></td>
<td style="vertical-align: bottom" class="xl30" width="149" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000">5.0</font></td>
</tr>
<tr style="height: 12.75pt" height="17">
<td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; vertical-align: bottom; border-top: black 0.5pt solid" class="xl26" height="17"><font face="Arial"></font><font style="font-size: 10pt" color="#000000"><strong>Grand Total</strong></font></td>
<td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; vertical-align: bottom; border-top: black 0.5pt solid" class="xl26" width="136" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000"><strong>509</strong></font></td>
<td style="border-bottom: black 0.5pt solid; vertical-align: bottom; border-top: black 0.5pt solid; border-right: black 0.5pt solid" class="xl29" width="181" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000"><strong>1973</strong></font></td>
<td style="vertical-align: bottom" class="xl30" width="149" align="right"><font face="Arial"></font><font style="font-size: 10pt" color="#000000"><strong>3.9</strong></font></td>
</tr>
</tbody>
</table>
<p>As it turns out, I sent a <em>lot</em> of mail to a <em>lot</em> of people throughout IBM, mostly in response to questions about Lotus Connections, Idea Labs, or collaboration tools. </p>
<p>Now I can sort my summarized data to see whom I e-mailed the most often, and add more names to my don’t-forget-to-say-goodbye list. If all goes well, I might even be able to use <a href="https://sachachua.com/blog/p/7189/">that mail merge script</a>. =)</p>
<p>The following agent processes selected messages and creates a table with one row per recipient, e-mailing the results to the specified mail address. It seems to choke on calendar entries and other weird documents, but if you go through your sent mail box in batches (Search This View by date is handy), then you should be able to find and delete the offending entries.</p>
<pre>Option Public
Dim TempNitem As NotesItem
Dim TempNm As NotesName
Dim session As  NotesSession
Dim db As NotesDatabase
Sub Initialize
	mailAddress = &quot;YOUR_ADDRESS@HERE&quot;
	
	Dim ws As New NotesUIWorkspace
	Dim uidoc As NotesUIDocument
	Dim partno As String
	Dim db As NotesDatabase
	Dim view As NotesView
	Dim doc As NotesDocument
	Dim collection As NotesDocumentCollection
	Dim memo As NotesDocument
	Dim body As NotesRichTextItem
	Dim range As NotesRichTextRange
	Dim count As Integer
	
	Set session = New NotesSession
	Set db = session.CurrentDatabase
	Set collection = db.UnprocessedDocuments
	
	Dim FldTitles(3) As String
	FldTitles(0) = &quot;E-mail&quot;
	FldTitles(1) = &quot;Subject&quot;
	FldTitles(2) = &quot;Date sent&quot;
	
	Set maildoc = db.CreateDocument
	maildoc.Form = &quot;Memo&quot;
	maildoc.Subject = &quot;Summary&quot;
	maildoc.SendTo = mailAddress
	Dim ritem As NotesRichTextItem
	Set ritem=New NotesRichTextItem(maildoc,&quot;body&quot;) 
' passing the rich text item &amp; other relevant details
	Set ritem = CreateTable(FldTitles, collection, ritem, &quot;Sent items&quot;, &quot;Summary created on &quot; + Format(Now, &quot;YYYY-MM-DD&quot;))
	maildoc.send(False)
End Sub
Function CreateTable(FldTitles As Variant, doccoll  As NotesDocumentCollection, rtitem As NotesRichTextItem,msgTitle As String,msgBody As String ) As NotesRichTextItem
	'http://searchdomino.techtarget.com/tip/0,289483,sid4_gci1254682_mem1,00.html
	'Takes  Documentcollection &amp; creates tabular information on to the passed   rtitem (rich text item)
	
	Set ritem=rtitem
	Set rtnav = ritem.CreateNavigator
	Set rstyle=session.CreateRichTextStyle 
	
	'===================================================
	'heading in the body section of the mail
	rstyle.Bold=True
	rstyle.NotesColor=COLOR_RED 
	rstyle.Underline=True
	rstyle.NotesFont=FONT_COURIER
	rstyle.FontSize=12
	Call  ritem.AppendStyle(rstyle)
	ritem.AppendText(msgTitle)
	
	rstyle.Underline=False
	rstyle.NotesColor=COLOR_BLACK
	ritem.AddNewline(2)
	
	rstyle.FontSize=10
	rstyle.Bold=False
	rstyle.NotesColor=COLOR_BLACK
	Call  ritem.AppendStyle(rstyle) 
	ritem.AppendText(msgBody)
	ritem.AddNewline(1)
	
	'===================================================
	rows=doccoll.Count +1
	cols=CInt(UBound(FldTitles)) 
	
	Call ritem.AppendTable(1, cols)
	Dim rtt As NotesRichTextTable
	Call rtnav.FindFirstElement(RTELEM_TYPE_TABLE)
	Set rtt = rtNav.GetElement 
	'=================================================
	'heading of the table
	rstyle.Bold=True
	rstyle.NotesColor=COLOR_BLUE 
	rstyle.FontSize=10
	Call  ritem.AppendStyle(rstyle)
	
	For i=0 To UBound(FldTitles) - 1
		Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
		Call ritem.BeginInsert(rtnav) 
		Call ritem.AppendText(FldTitles(i))
		Call ritem.EndInsert
	Next
	
	'=================================================
	rstyle.FontSize=10
	rstyle.Bold=False
	rstyle.NotesColor=COLOR_BLACK
	Call  ritem.AppendStyle(rstyle)
	Dim count As Integer
	count = 0
	Set  doc=doccoll.GetFirstDocument
	While Not (doc Is Nothing)
		subject = doc.GetFirstItem(&quot;Subject&quot;).values(0)
		posted = doc.GetFirstItem(&quot;PostedDate&quot;).values(0)
		Set sendTo = doc.getFirstItem(&quot;SendTo&quot;)
		For i = 0 To UBound(sendTo.values)
			Call rtt.AddRow(1)
			Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)   
			Call ritem.BeginInsert(rtnav)
			ritem.appendText(sendTo.values(i))
			Call ritem.EndInsert
			Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)   
			Call ritem.BeginInsert(rtnav)
			ritem.appendText(subject)
			Call ritem.EndInsert
			Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)   
			Call ritem.BeginInsert(rtnav)
			ritem.appendText(posted)
			Call ritem.EndInsert
		Next   
		count = count + 1
		Set doc=doccoll.GetNextDocument(doc)
	Wend
	Set CreateTable=ritem
	MsgBox &quot;E-mails summarized: &quot; &amp; count	
End Function</pre>
<p>I find it helpful to save it as the &quot;Summarize Recipients&quot; agent and assign it to a toolbar button that runs @Command([RunAgent]; &quot;Summarize Recipients&quot;).</p>

<p>You can <a href="https://sachachua.com/blog/2012/02/analyzing-my-lotus-notes-sent-mail-since-2011-01/#comment">view 4 comments</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2012%2F02%2Fanalyzing-my-lotus-notes-sent-mail-since-2011-01%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></description>
		</item><item>
		<title>Even more awesome LotusScript mail merge for Lotus Notes + Microsoft Excel</title>
		<link>https://sachachua.com/blog/2010/05/even-more-awesome-lotusscript-mail-merge-for-lotus-notes-microsoft-excel/</link>
		<dc:creator><![CDATA[Sacha Chua]]></dc:creator>
		<pubDate>Fri, 14 May 2010 12:00:00 GMT</pubDate>
    <category>geek</category>
<category>lotus</category>
		<guid isPermaLink="false">https://sachachua.com/blog/?p=7189</guid>
		<description><![CDATA[<div style="border: 1pt solid red; padding: 5px"><strong>UPDATE: May 20, 2011 &#8211; <a href="http://www.openntf.org/Projects/pmt.nsf/projectlookup/MailMerge%20Excel%20to%20Notes">David Turner has shared his excellent improvements.</a> Check them out!</strong></div>
<p>UPDATE: May 28, 2010 &#8211; fixed errors caused by default Option Declare. Thanks to Lisa Harnett for the feedback!<br>
UPDATE: Oct 19, 2010 &#8211; fixed Quit(). Thanks to Vance for the feedback! Also, clarified tokens.</p>
<p>Based on the feedback on my <a href="https://sachachua.com/blog/2009/07/lotus-notes-mail-merge-from-a-microsoft-excel-spreadsheet/">Lotus Notes mail merge from a Microsoft Excel spreadsheet (2009)</a>, I've refined my merge script to make it more awesome. How is it more awesome?  </p>
<ul>
<li>Prompts you for drafting or sending  </li>
<li>Saves sent messages  </li>
<li>Allows you to customize the subject </li>
<li>Uses [ ] instead of &lt; and &gt; for built-in tokens ([to], [cc], [subject]) for less HTML confusion in blog posts and replies </li>
<li>Displays number of sent messages and errors  </li>
<li>Closes the Microsoft Excel spreadsheet afterwards </li>
</ul>
<p>The search-and-replace tokens are defined in the first row of your Microsoft Excel spreadsheet. The script searches for them in the message body, replaces them with the appropriate values from the current row, and either saves the message as the draft or sends the message. There are a few built-in tokens for this script ([to], [cc], [subject]) &#8211; <strong>these are case-sensitive, so enter them exactly like that</strong>. All the other tokens are up to you, so you could use FOO and BAR as search-and-replace tokens if you want.</p>
<p>Tokens are replaced only in the message body. If you want a variable subject line, use a formula to calculate the subject in a column with the [subject] header.</p>
<p>As always, test your mail merges with a small list before using it for your entire list. Create an agent and call it something like &#8220;Mail merge&#8221;. Edit the agent and set the type to LotusScript. In the (Declarations) section, add </p>
<pre>%Include "lsconst.lss"
</pre>
<p>In the &#8220;Initialize&#8221; section, put in: </p>
<pre>Sub Initialize
	'Mail merge script by Sacha Chua (sacha@sachachua.com)

	Dim ws As NotesUIWorkspace
	Set ws = New NotesUIWorkspace
	Dim sendTypes(1) As String
	Dim sendValue As String
	Dim errorCount As Integer
	errorCount = 0
	sendTypes(0) = "Draft messages without sending"
	sendTypes(1) = "Send messages"
	sendValue = ws.Prompt(PROMPT_OKCANCELLIST, "Sending options", "What would you like to do?", "", sendTypes)
	If (sendValue = "") Then
		Exit Sub
	End If

	Dim fileName As String
	Dim strXLFilename As String
	'Prompt for the filename - should be a Microsoft Excel file with columns, where the first row of each column
	'is a token that will be used when replacing text in the body of the message
	'Special tokens: [to], [cc], [subject] set the appropriate fields
	'Make sure the first column does not have any blank cells
	fileName$ = ws.Prompt(12, "Select file", "3")
	If fileName$ = "" Then
		Exit Sub   'Cancel was pressed
	End If
	strXLFilename = fileName$
	Dim s As New NotesSession
	Dim uidoc As NotesUIDocument
	Dim partno As String
	Dim db As NotesDatabase
	Dim view As NotesView
	Dim doc As NotesDocument
	Dim collection As NotesDocumentCollection
	Dim memo As NotesDocument
	Dim body As NotesRichTextItem
	Dim newBody As NotesRichTextItem
	Dim range As NotesRichTextRange
	Dim count As Integer

	Set db = s.CurrentDatabase
	Set collection = db.UnprocessedDocuments
	Set memo = collection.getFirstDocument()

	Dim varXLFile As variant
	'Get data from the spreadsheet
	Set varXLFile = CreateObject("Excel.Application")
	varXLFile.Visible = False
	Dim varXLWorkbook As variant
	Set varXLWorkbook = Nothing
	varXLFile.Workbooks.Open strXLFilename
	Set varXLWorkbook = varXLFile.ActiveWorkbook
	Dim varXLSheet As variant
	Set varXLSheet = varXLWorkbook.ActiveSheet

	Dim lngRow As Integer
	Dim columnNo As Integer
	Dim token As String
	Dim value As string
	lngRow = 2
	Dim maildoc As NotesDocument
	While (Not (varXLSheet.Cells(lngRow, 1).Value = ""))
		'Fill in the template
		Dim subject As string
		subject = memo.Subject(0)
		Set body = memo.GetFirstItem("Body")

		'Compose message
		
		Set maildoc = New NotesDocument(db)
		Set maildoc= db.CreateDocument()
		maildoc.Form = "Memo"
		maildoc.Subject = subject
		Set newBody = maildoc.CreateRichTextItem("Body")
		Call newBody.appendRTItem(body)
		Set range = newBody.CreateRange			

		'Count the number of fields
		'Look up tokens from the column headings and replace them
		columnNo = 1
		While Not(varXLSheet.Cells(1, columnNo).Value = "")
			token = varXLSheet.Cells(1, columnNo).Value
			value = varXLSheet.Cells(lngRow, columnNo).Value
			count = range.FindAndReplace(token, value, 16)
			If (token = "[to]") Then
				maildoc.SendTo = value
			End If
			If (token = "[cc]") Then
				maildoc.CopyTo = value
			End If
			If (token = "[subject]") Then
				maildoc.Subject = value
			End If
			columnNo = columnNo + 1
		Wend
		On Error GoTo save
		If (sendValue = sendTypes(0)) Then
			Call maildoc.Save(True, False)
		Else
			maildoc.SaveMessageOnSend = True
			maildoc.PostedDate = Now()
			Call maildoc.Send(False)
			Call maildoc.Save(True, True)
		End If
		GoTo nextrow
save:
		MessageBox("Error processing " + maildoc.sendTo)
		errorCount = errorCount + 1
		Resume Next
nextrow:
		lngRow = lngRow + 1
	Wend
	If (sendValue = sendTypes(0)) Then
		MsgBox "Drafted " & (lngRow - errorCount - 2) & " message(s). Errors: " & errorCount
	Else
		MsgBox "Sent " & (lngRow - errorCount - 2) & " message(s). Errors: " & errorCount
	End If
	Call varXLFile.Quit()
End Sub
</pre>

<p>You can <a href="https://sachachua.com/blog/2010/05/even-more-awesome-lotusscript-mail-merge-for-lotus-notes-microsoft-excel/#comment">view 88 comments</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2010%2F05%2Feven-more-awesome-lotusscript-mail-merge-for-lotus-notes-microsoft-excel%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></description>
		</item><item>
		<title>Emacs Gnus: Organize Your Mail</title>
		<link>https://sachachua.com/blog/2008/05/emacs-gnus-organize-your-mail/</link>
		<dc:creator><![CDATA[Sacha Chua]]></dc:creator>
		<pubDate>Sat, 31 May 2008 20:47:17 GMT</pubDate>
    <category>emacs</category>
<category>wickedcoolemacs</category>
		<guid isPermaLink="false">https://sachachua.com/blog/?p=4905</guid>
		<description><![CDATA[<p>
People handle large volumes of mail in different ways. Keeping<br>
everything in one mailbox can quickly become unmanageable because<br>
messages you need to read get lost among messages you don&#8217;t need to<br>
read.
</p>
<p>
You can move mail manually by selecting them in the summary buffer and<br>
typing B m (gnus-summary-move-article). Then type the name of the<br>
group to which you would like to move the message. The group will be<br>
created if it doesn&#8217;t exist.
</p>
<p>
To move multiple messages, mark them with #<br>
(gnus-summary-mark-as-processable) and then type B m<br>
(gnus-summary-move-article). To unmark a message, type M-#<br>
(gnus-summary-unmark-as-processable). To unmark all messages, type M P<br>
U (gnus-summary-unmark-all-processable).
</p>
<h3>Automatically filing mail</h3>
<p>
Moving messages by hand is tedious and time-consuming. One way to deal<br>
with this is to set up rules that automatically file mail into<br>
different groups (or folders, as they&#8217;re called in other mail<br>
clients). Gnus calls this &#8220;splitting&#8221; mail, and you can split mail on<br>
IMAP servers as well as mail downloaded from POP3 servers to your<br>
computer.
</p>
<p>
For example, if you&#8217;re using Gnus to read mail from an IMAP server,<br>
you can split your messages by adding this to your ~/.gnus:
</p>
<p></p><pre>
 (setq nnimap-split-inbox "INBOX") ;; (1)
 (setq nnimap-split-predicate "UNDELETED") ;; (2)
 (setq nnimap-split-rule
       '(
         ("INBOX.emacs" "^Subject:.*emacs")
         ("INBOX.work" "^To:.*you@work.example.com")    
         ("INBOX.personal" "^To:.*you@personal.example.com")    
         ("INBOX.errors" "^From:.*\\(mailer.daemon\\|postmaster\\)")   
        )) 
</pre>
<p></p>
<p>
If you use a different inbox, change the value of<br>
nnimap-split-inbox(1). Any messages in the inbox will be split<br>
according to nnimap-split-rule(2), which is a list where each element<br>
is a list containing the group&#8217;s name and a regular expression<br>
matching the header of messages that should be filed in the group.  In<br>
this example, Gnus will move mail with subjects containing the word<br>
&#8220;emacs&#8221; to INBOX.emacs, mail directed to you@work.example.com to the<br>
INBOX.work group, mail directed to you@personal.example.com to the<br>
INBOX.personal group, and mail error messages to INBOX.errors. All<br>
other messages will be stored in INBOX.
</p>
<p>
If you&#8217;re downloading your mail from a POP3 server and storing it in<br>
nnml, add this to your ~/.gnus instead:
</p>
<p></p><pre>
 (setq nnmail-split-methods
      '(
        ("mail.emacs" "^Subject:.*emacs")
        ("mail.work" "^To:.*you@work.example.com")    
        ("mail.personal" "^To:.*you@personal.example.com")    
        ("mail.errors" "^From:.*\\(mailer.daemon\\|postmaster\\)")   
       )) 
</pre>
<p></p>
<p>
All other messages will be stored in mail.misc.
</p>
<p>
Start M-x gnus again, and your mail will be split into the different<br>
groups.
</p>
<h3>Where are my groups?</h3>
<p>
If you don&#8217;t see your new groups in the group buffer displayed by M-x<br>
gnus, type A A (gnus-group-list-active) to see all the groups. Go to<br>
the group that you would like to add to the group buffer, then type u<br>
(gnus-group-unsubscribe-current-group) to toggle its subscription. In<br>
this example, INBOX.automated is not subscribed to, but INBOX is.
</p>
<p></p><pre>
 U    13: INBOX.automated 
      76: INBOX 
</pre>
<p></p>
<p>
When you type M-x gnus again, you&#8217;ll see your subscribed groups if<br>
they have unread messages.
</p>
<p>
nnimap-split-rule and nnmail-split-methods allow you to filter<br>
interesting or uninteresting mail into different groups based on their<br>
headers. Gnus comes with an even more powerful mail splitting engine.<br>
In fact, Gnus comes with &#8220;fancy mail splitting.&#8221;
</p>
<h3>Fancy mail splitting</h3>
<p>
With fancy mail splitting and some configuration, you can split mail<br>
based on a combination of criteria. You can even manually file a<br>
message and have Gnus automatically file incoming replies in the same<br>
group.
</p>
<p>
To configure an IMAP connection to use fancy mail splitting, add the<br>
following to your ~/.gnus:
</p>
<p></p><pre>
 (setq nnimap-split-inbox "INBOX")
 (setq nnimap-split-predicate "UNDELETED")
 (setq nnmail-split-fancy ;; (1)
       '(|                                ;; (2)
         (: gnus-registry-split-fancy-with-parent) ;; (3)
         ;; splitting rules go here       ;; (4)
         "INBOX"                          ;; (5)
        ))
 (setq nnimap-split-rule 'nnmail-split-fancy)
 (setq nnmail-split-methods 'nnimap-split-fancy) ;; (6)
 (gnus-registry-initialize) ;; (7)
</pre>
<p></p>
<p>
This configures IMAP to use the nnmail-split-fancy function to<br>
determine the group for messages. Note that we&#8217;re setting the<br>
nnmail-split-fancy variable here. If you want to process your IMAP<br>
mail separately from your other mail, you can set the<br>
nnimap-split-fancy variable instead. If so, also set nnimap-split-rule<br>
to &#8216;nnimap-split-fancy. Using nnmail-split-fancy here makes the other<br>
examples easier to understand, though.
</p>
<p>
The nnmail-split-fancy variable controls the splitting behavior(1). The<br>
&#8220;|&#8221; symbol means that that the first matching rule is used(2). For<br>
example, if the message being processed is a reply to a message that<br>
Gnus knows about, then the gnus-registry-split-fancy-with-parent<br>
function will return the name of the group, and nnmail-split-fancy<br>
will file the message there(3).  You can add other splitting rules as<br>
well(4). If messages don&#8217;t match any of these rules, the last rule<br>
specifies that the messages will be filed in INBOX(5). Set<br>
nnmail-split-methods to nnimap-split-fancy as well in order to work<br>
around some assumptions in other parts of the code(6). After that,<br>
initialize the Gnus registry(7), which is responsible for tracking<br>
moved and deleted messages. This allows you to automatically split<br>
replies into the same folders as the original messages.
</p>
<p>
To configure fancy mail splitting with an nnml backend (suggested<br>
configuration for POP3), add the following to your ~/.gnus instead:
</p>
<p></p><pre>
 (gnus-registry-initialize)
 (setq nnmail-split-fancy                 
       '(|                                
         (: gnus-registry-split-fancy-with-parent)
         ;; splitting rules go here       
         "mail.misc"                          ;; (1)
        ))
 (setq nnmail-split-methods 'nnmail-split-fancy)    
</pre>
<p></p>
<p>
This code is similar to the IMAP example, except that the default<br>
mailbox name for nnml is mail.misc(1).
</p>
<p>
Here&#8217;s how the previous rules in nnmail-split-methods would be<br>
translated to nnmail-split-fancy rules for an IMAP configuration:
</p>
<p></p><pre>
 (setq nnmail-split-fancy
      '(|
        (: gnus-registry-split-fancy-with-parent)
         ;; splitting rules go here       
        (from mail "INBOX.errors")   ;; (1)
        (any "you@work.example.com" "INBOX.work")   ;; (2)
        (any "you@personal.example.com" "INBOX.personal") ;; 
        ("subject" "emacs" "INBOX.emacs") ;; (3)
        "INBOX"    ;; or "mail.misc" for nnml/POP3
       )) 
</pre>
<p></p>
<p>
The <code>from</code> keyword matches against the &#8220;From&#8221;, &#8220;Sender&#8221;, and<br>
&#8220;Resent-From&#8221; fields, while the mail keyword matches common mail<br>
system addresses(1). The corresponding <code>to</code> keyword matches against<br>
the &#8220;To&#8221;, &#8220;Cc&#8221;, &#8220;Apparently-To&#8221;, &#8220;Resent-To&#8221; and &#8220;Resent-Cc&#8221; headers,<br>
while <code>any</code> matches the fields checked by the <code>from</code> and <code>to</code><br>
keywords(2). You can also compare against the subject<br>
and other headers(3).
</p>
<p>
You can use logic in splitting rules, too. For example, if you like<br>
reading the jokes on joke-mailing-list@example.com, but you don&#8217;t like<br>
the ones sent by vi-guy@example.com (he not only has a bad sense of<br>
humor, but also likes picking on Emacs!), you can use a rule like<br>
this in your nnmail-split-fancy:
</p>
<p></p><pre>
         ;; ... other splitting rules go here...
         (any "joke-mailing-list@example.com"   ;; (1)
              (| (from "vi-guy@example.com" "INBOX.junk") ;; (2)
                 "INBOX.jokes")) ;; (3)
         ;; ... other splitting rules go here
</pre>
<p></p>
<p>
The first rule matches all messages with<br>
&#8220;joke-mailing-list@example.com&#8221; in from- or to-related headers.<br>
Matching messages are processed with another split rule, which moves<br>
messages from vi-guy@example.com to a separate group(2) and files the<br>
other messages in INBOX.jokes(3). To learn more about creating complex<br>
rules, read the Gnus Info manual for &#8220;Fancy Mail Splitting&#8221;.</p>

<p>You can <a href="https://sachachua.com/blog/2008/05/emacs-gnus-organize-your-mail/#comment">view 1 comment</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F05%2Femacs-gnus-organize-your-mail%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></description>
		</item><item>
		<title>Emacs Gnus: Searching Mail</title>
		<link>https://sachachua.com/blog/2008/05/emacs-gnus-searching-mail/</link>
		<dc:creator><![CDATA[Sacha Chua]]></dc:creator>
		<pubDate>Sat, 31 May 2008 12:49:37 GMT</pubDate>
    <category>emacs</category>
<category>wickedcoolemacs</category>
		<guid isPermaLink="false">https://sachachua.com/blog/?p=4902</guid>
		<description><![CDATA[<p>
There are several ways to find messages in Emacs. From the summary<br>
buffer, you can use / o (gnus-summary-insert-old-articles) to display<br>
all or some old messages. You can then scan through the headers in the<br>
summary buffer by using C-s (isearch-forward), or you can limit the<br>
displayed messages with these commands:
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<col align="left">
<col align="left">
<col align="left">
<tbody>
<tr>
<td>Messages from a given author</td>
<td width="50">/&nbsp;a</td>
<td>gnus-summary-limit-to-author</td>
</tr>
<tr>
<td>Messages whose subjects matching a given regular expression</td>
<td>/ /</td>
<td>gnus-summary-limit-to-subject</td>
</tr>
<tr>
<td>Messages that match a given extra header</td>
<td>/ x</td>
<td>gnus-summary-limit-to-extra-headers</td>
</tr>
<tr>
<td>Messages at least N days old</td>
<td>/ t</td>
<td>gnus-summary-limit-to-age</td>
</tr>
</tbody>
</table>
<p>
Limits work on the messages that are currently displayed, so you can<br>
apply multiple limits. If you make a mistake, use / w<br>
(gnus-summary-pop-limit) to remove the previous limit. You can repeat<br>
/ w (gnus-summary-pop-limit) until satisfied. To remove all the<br>
limits, type C-u / w (gnus-summary-popl-limit).
</p>
<p>
If you specify a prefix, the limit&#8217;s meaning is reversed.  For<br>
example, C-u / a (gnus-summary-limit-to-author) will remove the<br>
messages from the matching author or authors.
</p>
<p>
You can use Gnus to search the currently-displayed messages by using<br>
M-s (gnus-summary-search-article-forward) and M-r<br>
(gnus-summary-search-article-backward).
</p>
<p>
If you want to search a lot of mail, you&#8217;ll find NNIR handy. NNIR is a<br>
front-end to mail search engines which can index your mail and return<br>
search results quickly. If you want to use NNIR with a local or remote<br>
IMAP server, you will need to use nnir.el and imap.el. If you download<br>
your mail using fetchmail or connect to a POP3 server and use an nnml<br>
backend, you can use NNIR with a search engine such as swish-e to<br>
search your ~/Mail directory efficiently.
</p>
<div class="outline-5">
<h5 id="sec-17">1.6.7.1 Setting up IMAP and NNIR</h5>
<p>
If you use IMAP, then your mail is stored on the mail server and<br>
you&#8217;ll need to use the IMAP search interface to search through<br>
it. Download nnir.el from<br>
<a href="http://www.emacswiki.org/cgi-bin/wiki/download/nnir.el">http://www.emacswiki.org/cgi-bin/wiki/download/nnir.el</a> and save it to<br>
your ~/elisp directory. You will also need an imap.el that is newer<br>
than the one that comes with Emacs 22. Download imap.el from<br>
<a href="http://www.emacswiki.org/cgi-bin/wiki/download/imap.el">http://www.emacswiki.org/cgi-bin/wiki/download/imap.el</a> and save it to<br>
your ~/elisp directory as well. Because Gnus comes with an older<br>
version of imap.el, you will need to make sure that the new version of<br>
imap.el is loaded. Add the following to your ~/.gnus:
</p>
<pre>
(add-to-list 'load-path "~/elisp")
(load-file "~/elisp/imap.el")
(require 'nnir)
</pre>
<p>
Restart your Emacs. You can check if the correct version of imap.el<br>
has been loaded by typing M-x locate-library and specifying<br>
imap.el. If Emacs reports &#8220;~/elisp/imap.el&#8221;, then Gnus is configured<br>
to use the updated imap.el.
</p>
</div>
<div class="outline-5">
<h5 id="sec-18">1.6.7.2 Setting up POP3 and NNIR</h5>
<p>
If you use the configuration for POP3 that is suggested in this<br>
chapter, then your mail is stored in the nnml backend, which uses one<br>
file per message. To search this using NNIR, to install nnir.el and an<br>
external search mail engine. The Namazu search engine runs on Linux,<br>
UNIX, and Microsoft Windows, so that&#8217;s what we&#8217;ll talk about here. To<br>
find and configure other mail search engines supported by NNIR, check<br>
out the comments in nnir.el.
</p>
<p>
First, you&#8217;ll need to download and install Namazu. If Namazu is<br>
available as a package for your distribution, install it that way, as<br>
it depends on a number of other programs. An installer for Microsoft<br>
Windows can be found at <a href="http://www.namazu.org/windows/">http://www.namazu.org/windows/</a> . If you need<br>
to build Namazu from source, you can get the source code and instructions<br>
from <a href="http://www.namazu.org">http://www.namazu.org</a> .
</p>
<p>
After you&#8217;ve installed Namazu, create a directory for Namazu&#8217;s index<br>
files, such as ~/.namazu-mail. Then index your mail by typing this at<br>
the command-line:
</p>
<pre>
mknmz &#45;&#45;mailnews -O ~/.namazu-mail ~/Mail
</pre>
<p>
and add the following to your ~/.gnus:
</p>
<pre>
(add-to-list 'load-path "~/elisp")
(require 'nnir)
(setq nnir-search-engine 'namazu)
(setq nnir-namazu-index-directory (expand-file-name "~/.namazu-mail"))
(setq nnir-namazu-remove-prefix (expand-file-name "~/Mail"))
(setq nnir-mail-backend gnus-select-method)
</pre>
</div>
<div class="outline-5">
<h5 id="sec-19">1.6.7.3 Searching your mail with NNIR</h5>
<p>
From the group buffer displayed by M-x gnus, you can type G G<br>
(gnus-group-make-nnir-group) to search your mail for a keyword.</p>
<p>
If you&#8217;re using the Namazu search engine, then you can use more<br>
sophisticated search queries such as:
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<col align="left">
<col align="left">
<tbody>
<tr>
<td>Linux Emacs</td>
<td>messages that contain both &#8220;Linux&#8221; and &#8220;Emacs&#8221;</td>
</tr>
<tr>
<td>Linux or Emacs</td>
<td>messages that contain either &#8220;Linux&#8221; or &#8220;Emacs&#8221;</td>
</tr>
<tr>
<td>Emacs not Linux</td>
<td>messages that contain &#8220;Emacs&#8221; but not &#8220;Linux&#8221;</td>
</tr>
<tr>
<td>Emacs and (Linux or Windows)</td>
<td>messages that contain &#8220;Emacs&#8221; and either &#8220;Linux&#8221; or &#8220;Windows&#8221;</td>
</tr>
<tr>
<td>&#8220;apple pie&#8221;</td>
<td>messages that contain the phrase &#8220;apple pie&#8221;</td>
</tr>
<tr>
<td>{apple pie}</td>
<td>messages that contain the phrase &#8220;apple pie&#8221;</td>
</tr>
<tr>
<td>+from:example@example.com</td>
<td>messages with example@example.com in the From: header</td>
</tr>
<tr>
<td>+subject:&#8221;apple pie&#8221;</td>
<td>messages with the phrase &#8220;apple pie&#8221; in the Subject: header</td>
</tr>
<tr>
<td>+subject:apple +subject:pie</td>
<td>messages whose Subject: headers contain both &#8220;apple&#8221; and &#8220;pie&#8221;</td>
</tr>
</tbody>
</table>
<p> If<br>
matching messages are found, then you will see a temporary group with<br>
the results. Although you can&#8217;t delete messages from this view,<br>
reading and replying to these messages is the same as reading and<br>
replying to regular messages.
</p>
<p>
To see a message in its original context, type G T<br>
(gnus-summary-nnir-goto-thread) from the summary buffer. This opens<br>
the message&#8217;s original group. If Gnus asks you how many articles to<br>
load, press RET to accept the default of all the articles.
</p>
</div>
<hr size="1">
This is a draft for the <a href="https://sachachua.com/blog/category/wickedcoolemacs">Wicked Cool Emacs</a> book I&#8217;m working on. =) Hope it helps!<p></p>

<p>You can <a href="https://sachachua.com/blog/2008/05/emacs-gnus-searching-mail/#comment">view 1 comment</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F05%2Femacs-gnus-searching-mail%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></description>
		</item><item>
		<title>Geek: How to use offlineimap and the dovecot mail server to read your Gmail in Emacs efficiently</title>
		<link>https://sachachua.com/blog/2008/05/geek-how-to-use-offlineimap-and-the-dovecot-mail-server-to-read-your-gmail-in-emacs-efficiently/</link>
		<dc:creator><![CDATA[Sacha Chua]]></dc:creator>
		<pubDate>Fri, 09 May 2008 02:07:09 GMT</pubDate>
    <category>emacs</category>
<category>geek</category>
		<guid isPermaLink="false">https://sachachua.com/blog/?p=4858</guid>
		<description><![CDATA[<div class="update">2015-12-24: Updated with config changes now that I&#8217;m back to using Gnus+dovecot+offlineimap+Gmail</div>
<div class="update">2014-04-09: This post is from 2008. =) I think I used dovecot+offlineimap because Gnus and maildir weren&#8217;t getting along properly and directly connecting with IMAP to Gmail&#8217;s server was slow, but things have probably changed a fair bit since then. I eventually moved to using the Gmail web interface for most things, but I still miss my Gnus setup!</div>
<blockquote>
<ol>
</ol>
<ol>
<li>Make sure you&#8217;ve set up Postfix or some other mail server that can send mail.</li>
<li>Install dovecot (IMAP server) and offlineimap (IMAP synchronization). You can probably find binaries for your distribution.</li>
<li>Edit /etc/dovecot/conf.d/10-mail.conf and set the following:
<pre>mail_location = maildir:~/Maildir:LAYOUT=fs</pre>
</li>
<li>Use the instructions from <a href="http://unix.stackexchange.com/questions/44214/encrypt-offlineimap-password">http://unix.stackexchange.com/questions/44214/encrypt-offlineimap-password</a> to set up GPG-encrypted passwords. (optional)</li>
<li>Put the following in ~/.offlineimaprc, changing the details as needed.
<pre>[general]
accounts = SachaGmail
pythonfile = ~/bin/offlineimap-password.py

[Account SachaGmail]
localrepository = Local
remoterepository = Gmail
status_backend = sqlite

[Repository Local]
type = Maildir
localfolders = ~/Maildir

[Repository Gmail]
type = Gmail
maxconnections = 2
remoteuser = sacha@sachachua.com
realdelete = no
folderfilter = lambda foldername: foldername in ['INBOX', '[Gmail]/All Mail', '[Gmail]/Sent Mail', '[Gmail].Starred', '[Gmail].Drafts', '[Gmail].Important']
nametrans = lambda folder: re.sub('^INBOX$', '[Gmail].Inbox', folder)
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remotepasseval = mailpasswd("gmail")
</pre>
<p>If you feel comfortable specifying your password in your ~/.offlineimaprc, you can do so by changing remotepasseval to remotepass. If so, you don&#8217;t need the pythonfile line.</p></li>
<li><kbd>chmod go-rwx ~/.offlineimaprc</kbd> for a little bit of safety.</li>
<li>Type <b>offlineimap</b> to start synchronizing.</li>
<li>While that&#8217;s synchronizing, use something like this as your ~/.gnus:
<pre>(setq gnus-select-method
      '(nnimap "Mail"
	       (nnimap-address "localhost")
	       (nnimap-stream network)
	       (nnimap-authenticator login)))

(setq user-mail-address "youremail@example.com")
(setq gnus-ignored-from-addresses "youruser")
</pre>
</li>
<li>Start Emacs. Start Gnus with M-x gnus. If you don&#8217;t see the INBOX group, press ^ (gnus-group-enter-server-mode), open nnimap:Mail, move your cursor to the INBOX, and either press RET to go into the group or press u (gnus-browse-unsubscribe-current-group) to toggle the subscription status until you&#8217;re subscribed to the group. Then it should show up on the group screen (M-x gnus).</li>
</ol>
<p>Hope that helps. Have fun!</p></blockquote>

<p>You can <a href="https://sachachua.com/blog/2008/05/geek-how-to-use-offlineimap-and-the-dovecot-mail-server-to-read-your-gmail-in-emacs-efficiently/#comment">view 6 comments</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F05%2Fgeek-how-to-use-offlineimap-and-the-dovecot-mail-server-to-read-your-gmail-in-emacs-efficiently%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></description>
		</item><item>
		<title>Wicked Cool Emacs: BBDB: Keeping track of contact dates</title>
		<link>https://sachachua.com/blog/2008/03/wicked-cool-emacs-bbdb-keeping-track-of-contact-dates/</link>
		<dc:creator><![CDATA[Sacha Chua]]></dc:creator>
		<pubDate>Sat, 01 Mar 2008 08:49:00 GMT</pubDate>
    <category>emacs</category>
<category>wickedcoolemacs</category>
		<guid isPermaLink="false">https://sachachua.com/blog/?p=4792</guid>
		<description><![CDATA[<div>
  <p>I hadn’t realized just how much I missed my Big Brother Database until today. Three networking events packed into one week meant that I hadn’t set aside enough time for follow up, and I felt my memories of the conversations getting a little hazy. Fortunately I’d taken some notes on my Palm, but I knew I had to get it into some kind of contact management system quickly, and Gmail Contacts just wasn’t compelling enough for me. So it’s back to Emacs, plain text files, and a surprisingly sophisticated contact manager.</p>

  <p>I also promised to do some work on the book today, so everything dovetailed nicely.</p>

  <p>The following bit of code helps me filter displayed contacts to show only the people I haven’t contacted since a certain date. This is handy for remembering to keep in touch with old friends, for example. Or at least it would be handy if I used it more often and if I actually sent the letters that pile up in my e-mail drafts and my snail mail outbox… but at least it’s a step in the right direction.</p>

  <p>If you want to know who you have or haven’t talked to in a while, you need to do two things. First, you need to keep track of when you talked to people. Second, you need to generate reports.</p>

  <p>To be able to quickly add contact notes to BBDB records, add the following to your 
    <i>~/.emacs</i>:
  </p>

  <h3>ch6-bbdb-ping.el:</h3>

  <pre>
(define-key bbdb-mode-map 
    <span class="org-string">&quot;z&quot;</span> &apos;wicked/bbdb-ping-bbdb-record)
(
    <span class="org-keyword">defun</span> 
    <span class="org-function-name">wicked/bbdb-ping-bbdb-record</span> (bbdb-record text 
    <span class="org-type">&amp;optional</span> date regrind)
  
    <span class="org-doc">&quot;Adds a note for today to the current BBDB record.
Call with a prefix to specify date.
BBDB-RECORD is the record to modify (default: current).
TEXT is the note to add for DATE.
If REGRIND is non-nil, redisplay the BBDB record.&quot;</span>
  (interactive (list (bbdb-current-record t)
                     (read-string 
    <span class="org-string">&quot;Notes: &quot;</span>)
                     
    <span class="org-comment-delimiter">;; </span>
    <span class="org-comment">Reading date - more powerful with Planner, but we&apos;ll make do if necessary
</span>                     (
    <span class="org-keyword">if</span> (
    <span class="org-keyword">featurep</span> &apos;
    <span class="org-constant">planner</span>)
                         (
    <span class="org-keyword">if</span> current-prefix-arg (planner-read-date) (planner-today))
                       (
    <span class="org-keyword">if</span> current-prefix-arg
                           (read-string 
    <span class="org-string">&quot;Date (YYYY.MM.DD): &quot;</span>)
                         (format-time-string 
    <span class="org-string">&quot;%Y.%m.%d&quot;</span>)))
                     t))
  (bbdb-record-putprop bbdb-record
                       &apos;contact
                       (concat date 
    <span class="org-string">&quot;: &quot;</span> text 
    <span class="org-string">&quot;\n&quot;</span>
                               (or (bbdb-record-getprop bbdb-record &apos;contact))))
  (
    <span class="org-keyword">if</span> regrind
      (
    <span class="org-keyword">save-excursion</span>
        (set-buffer bbdb-buffer-name)
        (bbdb-redisplay-one-record bbdb-record)))
  nil)

  </pre>

  <p>You can then use 
    <bold>z</bold> in BBDB buffers to add a quick note to the “contact” field of the current record. The date is automatically noted. You can create a note for a specific date by calling 
    <kbd>C-u wicked/bbdb-ping-bbdb-record</kbd> with a prefix argument. For convenience, the suggested configuration binds this to “z”, because it was one of the few unbound keys I could find.  Use this after you meet, call, or e-mail people, and write down a short note about the conversation you had. You might find these notes useful later on.
  </p>

  <p>If you met a number of people at an event in the past and you have Planner installed and loaded, you can use 
    <kbd>planner-timewarp</kbd> to set the effective date to another date. To return to today, use 
    <kbd>M-x planner-timewarp nil</kbd>.
  </p>

  <p>To automatically add a datestamped copy of sent e-mail subjects to people’s BBDB records, add the following to your 
    <i>~/.gnus</i>:
  </p>

  <h3>ch6-bbdb-message-add-subject.el:</h3>

  <pre>
(
    <span class="org-keyword">defun</span> 
    <span class="org-function-name">wicked/message-add-subject-to-bbdb-record</span> ()
  
    <span class="org-doc">&quot;Add datestamped subject note for each person this message has been sent to.&quot;</span>
  (
    <span class="org-keyword">let*</span> ((subject (concat (format-time-string 
    <span class="org-string">&quot;%Y.%m.%d&quot;</span>)
                          
    <span class="org-string">&quot;: E-mail: &quot;</span> (message-fetch-field 
    <span class="org-string">&quot;Subject&quot;</span>) 
    <span class="org-string">&quot;\n&quot;</span>))
         (bbdb-get-addresses-headers
          (list (assoc &apos;recipients bbdb-get-addresses-headers)))
         records)
    (setq records
          (bbdb-update-records
           (bbdb-get-addresses nil gnus-ignored-from-addresses &apos;gnus-fetch-field)
           nil nil))
    (mapc (
    <span class="org-keyword">lambda</span> (rec)
            (bbdb-record-putprop rec
                                 &apos;contact
                                 (concat subject
                                         (or
                                          (bbdb-record-getprop rec &apos;contact)
                                          
    <span class="org-string">&quot;&quot;</span>))))
          records)))
(add-hook &apos;message-send-hook &apos;wicked/message-add-subject-to-bbdb-record)

  </pre>

  <p>Now that you have the data, how can you use it to filter? Add the following to your 
    <i>~/.emacs</i>:
  </p>

  <h3>ch6-bbdb-show-only-no-contact-since.el:</h3>

  <pre>
(
    <span class="org-keyword">defun</span> 
    <span class="org-function-name">wicked/bbdb-show-only-no-contact-since</span> (date 
    <span class="org-type">&amp;optional</span> reverse records)
  
    <span class="org-doc">&quot;Show only people who haven&apos;t been pinged since DATE or at all.
If REVERSE is non-nil, show only the people you&apos;ve contacted on or since DATE.
Call with a prefix argument to show only people you&apos;ve contacted on or since DATE.&quot;</span>
  (interactive (list
                (
    <span class="org-keyword">if</span> (
    <span class="org-keyword">featurep</span> &apos;
    <span class="org-constant">planner</span>)
                    (planner-read-date)
                  (read-string 
    <span class="org-string">&quot;Date (YYYY.MM.DD): &quot;</span>))
                current-prefix-arg (or bbdb-records (bbdb-records))))
  (
    <span class="org-keyword">let</span> (new-records
        last-match
        timestamp
        omit
        notes)
    (
    <span class="org-keyword">while</span> records
      
    <span class="org-comment-delimiter">;; </span>
    <span class="org-comment">Find the latest date mentioned in the entry
</span>      (
    <span class="org-keyword">let</span> ((timestamp (wicked/bbdb-last-date
                        (
    <span class="org-keyword">if</span> (vectorp (car records))
                            (car records)
                          (caar records)))))
        (
    <span class="org-keyword">if</span> (
    <span class="org-keyword">if</span> reverse
                
    <span class="org-comment-delimiter">;; </span>
    <span class="org-comment">Keep if contact is &gt;= date
</span>                (null (string&lt; timestamp date))
              
    <span class="org-comment-delimiter">;; </span>
    <span class="org-comment">Keep if date &gt; contact
</span>              (string&gt; date timestamp))
            (add-to-list &apos;new-records (
    <span class="org-keyword">if</span> (vectorp (car records))
                            (car records)
                          (caar records)) t)))
      (setq records (cdr records)))
    (bbdb-display-records new-records)))

(
    <span class="org-keyword">defun</span> 
    <span class="org-function-name">wicked/bbdb-last-date</span> (rec)
  
    <span class="org-doc">&quot;Return the most recent date for REC or nil if none.
Dates should be in the form YYYY.MM.DD.  The first date in the
notes field and the first date in the contact field are used, so
dates should be in reverse chronological order.&quot;</span>
  (
    <span class="org-keyword">let*</span> ((wicked/date-regexp
          
    <span class="org-string">&quot;\\&lt;</span>
    <span class="org-string">
      <span class="regexp-grouping-backslash">\\</span>
    </span>
    <span class="org-string">
      <span class="regexp-grouping-construct">(</span>
    </span>
    <span class="org-string">[1-9][0-9][0-9][0-9]</span>
    <span class="org-string">
      <span class="regexp-grouping-backslash">\\</span>
    </span>
    <span class="org-string">
      <span class="regexp-grouping-construct">)</span>
    </span>
    <span class="org-string">\\.</span>
    <span class="org-string">
      <span class="regexp-grouping-backslash">\\</span>
    </span>
    <span class="org-string">
      <span class="regexp-grouping-construct">(</span>
    </span>
    <span class="org-string">[0-9][0-9]?</span>
    <span class="org-string">
      <span class="regexp-grouping-backslash">\\</span>
    </span>
    <span class="org-string">
      <span class="regexp-grouping-construct">)</span>
    </span>
    <span class="org-string">\\.</span>
    <span class="org-string">
      <span class="regexp-grouping-backslash">\\</span>
    </span>
    <span class="org-string">
      <span class="regexp-grouping-construct">(</span>
    </span>
    <span class="org-string">[0-9][0-9]?</span>
    <span class="org-string">
      <span class="regexp-grouping-backslash">\\</span>
    </span>
    <span class="org-string">
      <span class="regexp-grouping-construct">)</span>
    </span>
    <span class="org-string">\\&gt;&quot;</span>)
         
    <span class="org-comment-delimiter">;; </span>
    <span class="org-comment">Get the first date mentioned in the notes field
</span>         (notes-date
          (or (and (string-match wicked/date-regexp (or (bbdb-record-notes rec) 
    <span class="org-string">&quot;&quot;</span>))
                   (match-string 0 (or (bbdb-record-notes rec) 
    <span class="org-string">&quot;&quot;</span>)))
              
    <span class="org-string">&quot;0000.00.00&quot;</span>))
         
    <span class="org-comment-delimiter">;; </span>
    <span class="org-comment">Get the first date mentioned in the contact field
</span>         (contact-date
          (or (and (string-match wicked/date-regexp (or (bbdb-record-getprop rec &apos;contact) 
    <span class="org-string">&quot;&quot;</span>))
                   (match-string 0 (or (bbdb-record-getprop rec &apos;contact) 
    <span class="org-string">&quot;&quot;</span>)))
              
    <span class="org-string">&quot;0000.00.00&quot;</span>)))
    
    <span class="org-comment-delimiter">;; </span>
    <span class="org-comment">Compare the two dates
</span>    (or (
    <span class="org-keyword">if</span> (string&lt; notes-date contact-date) contact-date notes-date)
        
    <span class="org-string">&quot;0000.00.00&quot;</span>)))

  </pre>

  <p>To generate a report, use 
    <kbd>M-x wicked/bbdb-show-only-no-contact-since</kbd> and specify the date.  These functions are much easier to use with Planner’s date-handling functions. Planner can read dates like “-1” (yesterday), “-7fri” (seven Fridays ago), “2” (the second of this month), “1.2” (January 2 in this year), and “2007.01.02” (January 2, 2007).
  </p>

  <p>You can also flip the filter by using the universal prefix argument (\{\{C-u M-x wicked/bbdb-show-only-no-contact-since\}\}) to show only the people you’ve contacted since a certain date. This is good for knowing the size of your active network. Because the filter works on displayed records, you can combine it to find all the people you talked to last year but not this year. You can also combine it with other filters to find all the people you’ve marked as friends, but who you haven’t talked to in three months. Then you can send a personalized e-mail or make a phone list, and get back in touch. And that’s how you keep track of your contact dates!</p>

</div>
<p>You can <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F03%2Fwicked-cool-emacs-bbdb-keeping-track-of-contact-dates%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></description>
		</item>
	</channel>
</rss>