Pine

IMAP
These settings in /usr/local/etc/pine.conf get pine working with imap:

user-domain=hobbiton.org smtp-server=localhost inbox-path={localhost/novalidate-cert/tls/user=${USER}}INBOX folder-collections=Private {localhost/novalidate-cert/tls/user=${USER}}[] default-fcc={localhost/novalidate-cert/tls/user=${USER}}Sent feature-list=enable-bounce-cmd,allow-talk,enable-full-header-and-text,enable-full-header-cmd,enable-tab-completion

Those options are slash-separated lists of settings.
 * user=${USER} means don't prompt the users for their username. If their imap usernames may be different from their local usernames, take this out.
 * novalidate-cert means you're using a self-signed certificate. If you aren't, take that out.
 * default-fcc (file carbon copy) is your sent-mail folder.

Delete Moves To Trash
First, create a new folder called Trash: [M]ain [L]ist [A]dd.

Then, create a new filter:


 * [M]ain [S]etup [R]ules [F]ilters [A]dd
 * Nickname = Delete moves to Trash
 * Current Folder Type = Email
 * Message is Deleted = Yes
 * Filter Action = Move, Folder List = Trash
 * Set New Status = Clear this state
 * Save the filter: [E]xit [Y]es [E]xit [Y]es

Alternatively, instead of creating the filter in the menus, add this setting to .pinerc:

patterns-filters2=LIT:pattern="/NICK=Delete moves to Trash/FLDTYPE=EMAIL/FOLDER=INBOX/STATD=YES" action="/FILTER=1/FOLDER=Trash/NOKILL=1/STATN=CLR"

Now every time you hit D to delete a message it will be marked "deleted" but when you expunge (X), it will be moved to the Trash folder. Remember to empty the Trash folder once in a while, or add Trash to pruned-folders so that the Trash folder is renamed at the end of the month just like the sent-mail folder.

Caveats
Pine really needs better support for a Trash mailbox. Every other popular client supports it. Please update this article if there's a better way.


 * When the filter works, you won't be prompted to confirm e[X]punging message anymore. (This seems reasonable, but is worth noting.)
 * This will likely confict with concurrent mail clients that don't expunge immediately when moving message to Trash. It could easily cause "deleted" message to be lost before they make it to the Trash folder.  (This has not been verified.)
 * This causes duplicate messages when [S]aving a message to another folder. Saving copies the message then marks it as deleted, then later the source message is expunged into the Trash folder too.

Acknowledgement

 * This is derived from http://mailman1.u.washington.edu/pipermail/pine-info/2006-March/070739.html