How To: Using Gmail with Alpine

I’ve tried a few of the different GUI clients out there, and I tend to find them to be almost as slow and bloated as Microsoft’s infamous Outlook. The main clients are Mozilla’s Thunderbird and Gnome’s Evolution.

In search of speedier email access, I decided to go searching for a command-line solution. My Conky tells me when I have new mail, and at that point I want to be able to quickly open a client, look at the email, and close it again, without having to wait for the client to load up and then pack itself away again after. I also don’t want to have to leave the client open all the time.

Since I use Gmail, the best solution is for me to find a client that can use the IMAP protocol. As far as I can tell, this comes down to two options: Mutt or Alpine, the successor to the old Pine client. I tried Mutt, but I found it difficult to configure, especially considering I want access to all of my accounts, not just one, or one pooled inbox accepting mail from all of them.

That leaves Alpine, and to be honest, I’m quite happy with that. Alpine seems to do everything I need it to do, with relative ease. If you’re using Ubuntu, you can download and install it from the repository. Otherwise, you can find the latest version here.

The following guide just gives a basic rundown of how to set up Alpine for multiple gmail accounts. It assumes you are not also using a local mail server. For more detail on working with Alpine, you should see this excellent in-depth reference website.

Retrieving your INBOX

The first thing to worry about is how to set up Alpine so you can read your Gmail.

  • Once you’ve installed Alpine, run it by typing alpine at the command prompt. Then type go to Main>Setup>collectionLists>Add. In each case, you can get to the menu by just typing the letter I’ve highlighted in bold.
  • Fill in the options like this:

    Nickname : <choose a nickname>
    Server :
    Path :
    View :

    You can leave path and view blank.

  • Press <ctrl-x> to save your settings, and then go back to the collectionList and choose to Add as many different accounts as you wish. Press ‘E’ to exit the collectionList menu
  • There are a couple of configuration options you will want to change.
    • Go to Main Menu>Configuration and scroll down until you find the [Advanced User Preferences] section. Mark Save will Not Delete toward the end of that section.
    • Next go to Pruning Rule and choose don’t rename, don’t delete.
  • Hit ‘E’ to Exit setup, and choose yes to keep the settings.
  • To read your mails, go to the Main menu and choose ‘Folder List’. Hit ‘Enter’ to choose the folder you wish to look at, put in the password if necessary, and use ‘>’ and ‘<‘ to go back and forward between your folders to read your mails.

Sending mails through Gmail

To have the option of sending mails from different accounts, you need to use a feature called ‘Roles’.

  • Choose Setup>Rules, and type ‘R’ to choose ‘Roles’. ‘Add’ a new role.
  • Press ‘Enter’ to type in a nickname of your choice.
  • Under Current Folder Type go down to Specific and choose that.
  • Then go just below that to Folder List and press ‘T‘. You may need to input the password for your current folder. You can then navigate around the folder list and choose the folder that you want that Role to apply to. For example, if you’re looking at the inbox for account foo you want to send emails from foo. If you’re looking at account bar then that’s the account you want to send from too.
  • Now scroll all the way down to the section titled ACTIONS BEGIN HERE. Set the Set From field to the relevant account, eg ‘Foo Bar <>. Then set Use SMTP Server to the following:

  • Finally set Compose Use = to ‘With confirmation’. Hit ‘E’ to exit and save changes. Add a new role for each gmail account.


Filed under How To, Linux

30 responses to “How To: Using Gmail with Alpine

  1. Great tutorial there its really helpful,alpine is so good,better than mutt.I have written a similar tutorial for configuring mutt with gmail.Great Work!

  2. lusule

    Glad it helped, and thanks for the feedback!

  3. Aar

    Useful tutorial. I almost dropped pine for want of help with configuration.
    I also read somewhere that they recommend you add /novalidate-cert to avoid the certificate error.

  4. lusule

    I read that too, but I haven’t noticed a certificate error, so I haven’t put it in.

  5. Pingback: More terminal (aka CLI) programs to the rescue « Shinobu’s Secrets

  6. fs

    Thanks for this. It was exactly what I needed.

    I got a sendmail error the first time I tried to send mail using Gmail. I fixed it by editing .pinerc and adding the smtp servers where it said smtp-server.

  7. I’ve got alpine set up on my system to work with Gmail, but I find it annoying that my Gmail doesn’t download to my main inbox by default. Any idea how I can get it to work like that?

  8. I managed to find the answer to my own question 🙂

    Navigate through: Setup > Config

    Highlight ‘Inbox Path’, press enter then enter in the following:

    Also make sure to navigate to the “Incoming Startup Rule” section in the same screen and enable “first-recent” so that alpine shows you the most recent emails when you go into your Message Index.


  9. Useful tutorial 🙂 Thanks a lot 🙂

    Could you please say how to save password for both IMAP & SMTP for future use ?

    Also, how can I view replies as threads ?

  10. illumin8

    Thanks for this.
    It was the last puzzle piece to making Alpine the perfect Email Client.

  11. thank you for the tip!

    i had to add a port number to the smtp server to get it to work for me; i.e.

  12. eigen

    Thanks for the tutorial. I think it is quite useful. But how do you use conky as the new mail checker?

  13. Pingback: Alpine Mail Notifier « Root & Waste

  14. Pingback: Root & Waste : Alpine Mail Notifier

  15. Pingback: Alpine Mail Notifier « Onion Root

  16. Tomas

    IMAP is working for me… and it’s great…

    But no SMTP… i’m getting timeout error. Anyone knows what could be wrong?

  17. jagnanails

    I’ve followed this great tutorial to the letter and upon forwarding or replying to a message from an inbox the roles are correctly chosen but I keep getting asked for the SMTP server settings.

    I have the SMTP settings setup as above.

  18. Okay, might sound insane, here goes.

    I have a remote shell that uses alpine, and I want to know how to do the reverse, sending any emails that goes to alpine TO gmail account, all I have found after several hours (LITERALLY) of searching, is to get gmail to send to alpine. I need the reverse. Any help?

  19. ELP

    Great work. This instruction was what I was looking for.

  20. Pingback: Sending a gmail message from the good old command line. Part 2 « Blog personal de René Romero Benavides

  21. Pingback: Moving Mail in Alpine « Tanim Islam's Blog

  22. Hello, thanks for this manual. Very useful.
    Will create my own, and link it to your post.


  23. Thanks for the tutorial, really helped me out.

  24. Quick question though – how do I make Alpine remember my IMAP/SMTP passwords?

  25. If I send email from pine, than sent msg will be in sent-messages. How to change it on to “sent” on google account?

    • Jeff Stern

      i found the way that worked for me (alpine) was to:

      A) set Default-Fcc (in Main -> Setup -> Config) to two double-quotes (“”)


      B) use gmail’s SMTP, not my own company’s. outgoing email now saved in Gmail’s “Sent”, automatically

  26. elwoode

    any help for receiving email from you Hotmail account?

  27. Birdman

    Thanks for a great tutorial! It worked “out of the box”. After years of using pine for POP3 it’s remarkable to see it “do” IMAP. I wonder if I might ask a followup question though;

    1. My shell account username is (let’s say) “hamish”
    2. I setup alpine IMAP (gmail) to be

    BUT when I send email to myself at my corporate account (as a test) I see that it says it’s FROM “” which is altogether wrong. In other words, hitting Reply is gonna bounce because I’m not “” I’m “”

    Where is the setting that overrides my shell username and inserts my gmail username? (I’m fairly familiar with the alpine config file and looked up all the “usual suspects” but it’s clear I’m missing something fairly obvious.

    Regards & warm thanks for the tutorial once again.

  28. Pingback: Multiple Accounts with Alpine

  29. Ray

    Thank you very much. I’ve been going a bit nuts trying to figure out how to get alpine and gmail working together. After trying what quite a few other sites said (and failing miserably), I tried your recommendations and everything works now. Thanks again.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s