Skip to content
Karl Dahlke edited this page Jun 27, 2018 · 34 revisions

Edbrowse as an imap client.

There are two separate protocols to access your email, pop3 and imap. As of version 3.6.0, edbrowse supports both, with new imap features added in 3.7.4. However, imap servers can behave quite differently from one another. This article describes the behavior of the gmail imap server, which could differ from other servers in subtle ways. First, a brief review of pop3.

The pop3 interface fetches your emails from one or more pop3 accounts and stores them on your computer, deleting them from the server(s) in the process. You are presented with each email in turn, whereupon you can delete it, or save it to a file. Some emails are saved in files for you automatically based on filters in your .ebrc config file or your address book. (See the documentation for more details.) Assuming none of these filters applies, edbrowse presents the email to you, page by page, until you decide what to do with it. If you type h for help, the following help screen appears.

h       print this help message
q       quit this program
space   read more of this email
n       next email
d       delete this email
w       write this email to a file and delete it
u       write this email unformatted to a file and delete it

If an email has been saved in a local file, and you are viewing that file under edbrowse, the re command allows you to reply to this email. Use rea to reply all. This places various headers at the top of the file, including a References: line that you should not edit or delete. Edit the body, inserting your own comments, and type sm to send your reply back to the sender. This is the reply procedure for both pop3 and imap. The mail must be on your computer for edit, whereupon the rea and sm commands facilitate the reply.

If the mail was saved unformatted via the u command, then type b to browse, whereupon you can once again type re to reply, if that is what you wish to do.

It is generally safe to save the mail formatted, via the w command, because an unformatted copy is stored in ~/.trash/rawmail, just in case you need it in the future.

Imap is an entirely different philosophy. The server retains your emails, and you can view them from many different devices: computer, tablet, smart phone, etc. You don't typically delete an email from the Imap server unless you are sure you really don't need it any more, or you have copied it onto your computer and you don't need to view it from other devices any longer. Before we run a sample Imap session, let's look at the entries in the config file that provide both pop3 and imap access to gmail.

#  google mail pop3
mail {
inserver = pop.gmail.com
outserver = smtp.gmail.com
secure
login = fflintstone
password = Pebbles276
reply = [email protected]
from = Fred Flintstone
}

#  google mail imap
mail {
imap
inserver = imap.gmail.com
outserver = smtp.gmail.com
secure
login = [email protected]
password = Pebbles276
from = Fred Flintstone
reply = [email protected]
}

If these are the first two email entries in your config file, then edbrowse -f1 fetches the outstanding gmail via pop3, edbrowse -m views the emails just fetched, and edbrowse -fm1 does both in one go. edbrowse -f2 accesses your gmail through imap, and presents a screen somewhat like the following.

 1 INBOX, 0 messages
 2 [Gmail]/All Mail, 7 messages
 3 [Gmail]/Drafts, 0 messages
 4 [Gmail]/Important, 0 messages
 5 [Gmail]/Sent Mail, 0 messages
 6 [Gmail]/Spam, 41 messages
 7 [Gmail]/Starred, 0 messages
 8 [Gmail]/Trash, 21 messages
Select a folder by number or by substring.
q to quit, rf to refresh, l to change fetch limit.

You can create other folders, but these are the default under gmail. Type "create foo" to create a new folder, "rename foo bar" to rename it, and "delete bar" to remove it. These folder commands were introduced in 3.7.4. Returning to standard gmail, the first folder, called inbox, holds email that has not yet been read. pop3 fetches mail out of this folder and moves it to trash. This example shows 21 emails in trash, 21 emails that I have (perhaps) read and downloaded to my computer using pop3, though there are other ways for email to wind up in trash. I can quickly scan and remove emails from trash, gone forever, by selecting the trash folder and deleting each in turn with the d command. Type s to stop reading from this folder, as I did when I saw the Discover card notice, leaving the rest of the emails in the trash for later.

trash
21 messages
Lifeboat Foundation: is now following you on Twitter! Dec 13 2015 26K
delete
Indeed Job Alert: 1 new DBA opportunity Dec 13 2015 18K
delete
Popular in your network: The truth about fetal tissue Dec 13 2015 80K
delete
MSU Honors College: News & Updates Dec 14 2015 79K
delete
MyDomain Deals: get 20% off domains and web hosting Dec 15 2015 15K
delete
Discover Card: Your statement is on its way Dec 17 2015 44K
stop
end of folder

Another housekeeping chore is clearing out the spam. Like the trash, emails really do go away completely when deleted. Of course, if an email is not spam you can use the m command to move it somewhere else, even the inbox, whereupon it is available for pop3 fetch.

spam
41 messages
*Walgreens Notice: Pickup is required Dec 12 2015 5K
delete
*SaveFamilyMemories: Preserve Old 8mm and VHS Films Dec 12 2015 2K
delete
*PET FOOD COUPONS: You Can Save Dec 12 2015 4K
delete
*Josh Radonsky: Meet Life Science Investors Dec 14 2015 26K
delete
...

If I want to leave pop3 behind altogether, I can select inbox through imap and read and review those emails, moving them to other folders as I wish. Under gmail, you cannot meaningfully delete an email from inbox, or any of the other folders; you can only move it to trash, and then delete it from there. It's an awkward 2 step process, but there it is.

The All Mail folder is confusing at first, because it is a virtual folder, the way /proc is a virtual file system. Any email not in spam or trash appears in All Mail. It is a reflection of all your mail, or at least all the mail that you might reasonably care about.

Use the / command to search for a word in the subject of emails in the current folder. This is not a simple text fragment; foo will not match foobar. It is case insenssitive however. Use /f Karl to find emails with Karl in the from line, or /b baseball to find emails with baseball in the body of the email. The last 50 of these will be presented, instead of the last 50 emails in the folder. Again, you can step through them one by one, read them, save attachments, delete, write formatted or unformatted, or move to another folder. Type s to stop reading from this folder, or / for another search. Type l to change the fetch limit, how many emails presented at a time. Warning, as of this writing you can only search for ascii words. I've tried to make this international using utf8, and that works with some imap servers, but not gmail, for reasons unknown.

When saving files to your computer, there is a subtle difference between pop3 and imap. w saves the email formatted in both worlds, but it also deletes the email under pop3, but not under imap. If you want to save and delete in imap, use capital W, or capital U to save unformatted. Consider the following imap help screens, produced by typing h. the first appears if you are stepping through the emails at a high level, looking at the envelopes: sender, subject, date, and size. The second, with more options, appears when you are reading through an email with the space bar, and includes the w and u commands.

h       print this help message
q       quit this program
s       stop reading from this folder
n       continue to next message
d       delete this email
m       move this email to another folder
v       view all
b       batch move or delete
f       from move or delete
space   read and manage this email
/       search for words in subject, from, or body
l       set imap fetch limit

h       print this help message
q       quit this program
s       stop reading mail from this folder
n       next email
d       delete this email
m       move this email to another folder
v       view all
b       batch move or delete
f       from move or delete
space   read more of this email
w       write this email to a file
W       write this email to a file and delete it
u       write this email unformatted to a file
U       write this email unformatted to a file and delete it
a       scan and save attachments

The v (view all) command prints all the envelopes for all the emails that have been fetched, all the emails in the current "buffer". If you don't see anything untoward in this list, you can use the b (batch) command to act on all of them in one go. Follow up with d to delete, or m to move to another folder. The f (from) command is similar. Follow up with d or m to delete or move all the emails from this sender. Thus you can easily move all the email from Fred Flintstone into your cartoon folder. Server-side imap filters can do some of this work for you, but if you haven't set up these filters, or if they aren't working as expected, you can do it yourself.