Using alpine with Fastmail

I spent a bit of time the other day looking into using the terminal email client alpine with Fastmail. It wasn’t too hard, and things are working really well. There are basically four steps. (I’m using the default alpine provided by brew, on Mac OS.)

  1. Get an app password from Fastmail
  2. Set up IMAP, SMTP, and some default folders in alpine
  3. Set up a collection so you have access to your other Fastmail folders
  4. Create a basic mailcap so you can use Mac OS’ open command for attachments, and configure URL viewers

Get an app password from Fastmail

  1. In the Fastmail interface, open the dropdown that by default says “mail”, and choose “Settings”
  2. In “Settings”, select “Password & Security”
  3. Select “Manage” next to “App Passwords”. Enter your password, and generate a new app password
  4. I selected “Custom” for name, and entered “alpine”. For access, I selected “Mail”, giving me IMAP and SMTP
  5. Keep that password somewhere safe, but where you can find it. You’re going to be entering/pasting it often

Set up IMAP, SMTP, and default folders

  • In alpine, open the config by pressing S, then C from the main menu
  • For SMTP, enter smtp.fastmail.com:465/user=YOURUSERNAME/ssl
  • For Inbox Path, enter {imap.fastmail.com:993/user=YOURUSERNAME/ssl}Inbox
  • For Default Fcc, enter {imap.fastmail.com:993/user=YOURUSERNAME/ssl}Sent
  • For Default Saved Message Folder, enter {imap.fastmail.com:993/user=YOURUSERNAME/ssl}Archive
  • For Postponed Folder, enter {imap.fastmail.com:993/user=YOURUSERNAME/ssl}Drafts
  • For Trash Folder, enter {imap.fastmail.com:993/user=YOURUSERNAME/ssl}Trash
  • Exit and save your settings. You may need to restart alpine

Set up a collection list

  • From the main menu, edit collection lists by pressing S, then L
  • Enter Fastmail as your nickname
  • For the server, enter imap.fastmail.com:993/user=YOURUSERNAME/ssl
  • You will now be able to view all your folders from the main menu folder list

Create a basic mailcap and configure URL viewers

  • From the main menu, edit your config by pressing S, then C
  • Find (W for Whereis) “Enable Message View URL Links“, and enable it
  • Find “URL-Viewers“, and enter /usr/bin/open _URL_ to allow alpine to use the open command for inline URLs
  • Find “Mailcap Search Path“, and enter ~/.mailcap
  • Exit alpine, and create the file ~/.mailcap Into that file, paste the following:
application/*; /usr/bin/open %s
audio/*; /usr/bin/open %s
image/*; /usr/bin/open %s
text/*; /usr/bin/open %s
video/*; /usr/bin/open %s

This will allow you to use Mac OS’ default file handling applications for the majority of attachments you’ll come across.

One more point: you may find that your email address is funny. You can fix that by adding From: "Your Name" <your@email.com> to the custom-headers field.

Mac specifics for this post came from https://www.madboa.com/geek/pine-macosx/.