I would like to use a terminal based mail client for my e-mail activities. I've been suggested to use alpine for it. But how do I configure it in Ubuntu to read my gmail mails?


It's quite straightforward to configure Alpine to access your gmail account via the imap protocol, and there are many tutorials online such as this article.

As you probably know, the first thing to do is to go to the settings in your gmail account and make sure imap is enabled for your account.

Then fetch Alpine with

sudo apt-get install alpine

Alpine was developed at the University of Washington; it is a successor to the old Pine email program; more details are available here at the official site, although there is further development going on at the re-Alpine project. Indeed, the Alpine version in the repositories is re-Alpine version 2.02-3.1.

The following tutorial describes a minimal way to setup Alpine so that you can receive and send mail.

Start up Alpine in terminal by typing alpine, and you come to the main screen. From that main screen (M) go to setup (S) > add a new collection (L), as in the screenshot below. Add the name of the collection (Gmail) and imap.gmail.com:993/ssl/user=me@gmail.com in the server box (adding your proper gmail address of course).

Some guides such as this one and many others will recommend the novalidate-cert option to be added in the above imap line (and in the smtp line quoted later), but it is not necessary with the current version of Alpine, as there is no problem with the certificates.

enter image description here

Then go back to the main menu and go to setup > config (C) and place all your details in the appropriate boxes, as in the screenshot below, with this time adding also the smtp server (smtp.gmail.com:587/tls/user=me@gmail.com) and specifying your inbox path and personal name:

enter image description here

Now save and exit back to the menu. Now with this basic setup you should be able to read and send mail. If you want, you can exit the program and the load it up again to check everything has configured correctly, and the main screen should be something like this:

enter image description here

There are a lot more customisations that can be made and settings experimented with (the users' configuration file is .pinerc in the home folder), and you can even export Thunderbird mail to view in Alpine, as I discuss here:

  • My problem now (which I didn't use to experience earlier, soem years ago with such a configuration) is that Gmail shows me a message with a weblink to confirm the login, but alpine (and pine) don't have have enough length for it to fit. I'd appreciate an advice how to read the weblink through Alpine and confirm the login. – imz -- Ivan Zakharyaschev Dec 11 '15 at 10:50
  • 1
    Here at reddit, they, too, recommend turning on "less secure" apps in Gmail. I'd rather like an explanation what is wanted by Gmail and how to make an app secure. – imz -- Ivan Zakharyaschev Dec 11 '15 at 11:06
  • And here is this problem mentioned with Gnus: superuser.com/q/963361/65570 – imz -- Ivan Zakharyaschev Dec 11 '15 at 11:20
  • @imz works for me -- for what that's worth. I open alpine from gnome-terminal and use the arrow to select the link, then just press "enter". It either directly opens the link in firefox, or prompts, I don't recall. For me, works seamlesslly....what have you tried? – Thufir Jan 9 '17 at 12:37
  • @Thufir I believe I wasn't able to select such link with arrows: it just appeared in the status line, and well... how do I get with arrows there? Arrows just allow me to move through the menu items, don't they? – imz -- Ivan Zakharyaschev Jan 10 '17 at 13:57

From M S C the following entries in config:

User Domain                       = <No Value Set>                                                                                   
SMTP Server (for sending)         = smtp.gmail.com/novalidate-cert/user=hawat.thufir@gmail.com/ssl                                   
NNTP Server (for news)            = localhost                                                                                        
Inbox Path                        = {imap.gmail.com/novalidate-cert/ssl/user=hawat.thufir@gmail.com}INBOX                            
Incoming Archive Folders          = <No Value Set>                                                                                   
Pruned Folders                    = <No Value Set>       

plus manually adding the following by opening .pinerc with an editor like vi or nano to add the IMAP folders:

# List of directories where saved-message folders may be. First one is
# the default for Saves. Example: Main {host1}mail/[], Desktop mail\[]
# Syntax: optnl-label {optnl-imap-hostname}optnl-directory-path[]
    gmail {imap.gmail.com:993/ssl/user=hawat.thufir@gmail.com}[]

Of course, you can just make all those configurations directly in .pinerc with most any editor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.