Use the Alpine tool in Linux to access Gmail tutorials at the command line

Source: Internet
Author: User
Tags imap mail time interval gmail password

In this post, I'll show you another nifty use case for Linux command lines: Visit Google's Gmail service, and for that, we'll use Alpine, a ncurses-based multi-function command-line mail client (don't confuse Alpine Linux). We will configure Gmail's IMAP and SMTP settings in Alphine to receive and send mail in the terminal environment via Google's mail server. At the end of this tutorial, you will find that you can use other mail services in Alpine in just a few steps.

Admittedly, there are many excellent GUI-based mail clients that exist, such as Thunderbird, Evolution, or even the Web interface, so why are there people interested in using the command line mail client to collect Gmail? The answer is simple. If you need to deal with things quickly and want to avoid wasting unnecessary system resources; or you're working on a streamlined server with no console installed, it doesn't have an X service for graphical displays, or X services crashes on your desktop, and you need to be eager to send some emails before you solve the problem. In all of these cases, Alpine can be useful and meet your needs at any time.

In addition to simple editing, sending and receiving text-class mail messages, Alpine can also encrypt, decrypt, and digitally sign message information, as well as seamlessly integrate with TLS (note: Transport Layer Security, Transport layer encryption).

Install Alpine on Linux

On the release version based on Red Hat, you can install Alpine as follows. Note that on RHEL or CentOS, you need to first enable the Epel software repository.

The code is as follows:

# Yum Install Alpine

On Debian,ubuntu or their derivative distributions, you can do this:

The code is as follows:

# Aptitude Install Alpine

After the installation is complete, you can run the following command to start the mail client:

The code is as follows:

# Alpine

When you first enable Alpine, it creates a mail folder (~/mail) in the current user's home directory and displays the main interface, as shown in the following video: Youtubu video-Http://www.youtube.com/kuKiv3uze4U.

Its user interface has the following several modules:

Please feel free to browse and operate to familiarize yourself with Alpine. You can always go back to the command prompt interface by knocking ' Q ' at any time. Note that all of the character interfaces have help associated with the operation.

Before we go any further, we will create a default configuration file for Alpine. To do this, close Alpine, and then execute the following command at the command line:

The code is as follows:

# alpine-conf >/etc/pine.conf

Configure Alpine to use Gmail account

When you install Alpine and take at least a few minutes to familiarize yourself with its interface and menu, here's the time to actually configure it to use an existing Gmail account.

Before you perform the following steps in Alpine, remember to first enable the IMAP protocol in your Gmail settings through your Web mail interface. Once you have IMAP enabled in your Gmail account, perform the following steps to enable the ability to read Gmail information in Alpine.

First, start Alpine.

Press ' S ' to set, and then press ' L ' to select the Collectionlists option to define different folder categories to help you organize your emails better:

Press ' A ' to create a new folder and fill in the necessary information:

Nickname: Fill in any name you want to write;

The code is as follows:

Server:imap.gmail.com/ssl/user=yourgmailusername@gmail.com

You can leave the Path and View blank.

Then press ctrl+x and enter your Gmail password when prompted:

If everything goes as well as expected, a new folder will appear named after the nickname you have previously filled out. You should be able to find your Gmail box here:

To verify this, you can compare the "Gmail Sent" box shown in Alpine and the mailbox under the Web interface:

By default, it automatically checks for new messages or prompts every 150 seconds, and you can change the value in the file/etc/pine.conf, and you can modify many other settings. This configuration file has detailed and clear annotations. For example, to set the time interval for checking a new message to 10 seconds, you need to set this:

The code is as follows:

# The approximate number of seconds between checks for new mail

mail-check-interval=10

Finally, we need to configure an SMTP server to send messages via Alpine. To go back to the previously explained Alpine settings interface, and then press ' C ' to set a Google SMTP server address, you need to edit the same line as the following for SMTP server (for sending mail):

The code is as follows:

Smtp.gmail.com:587/tls/user=yourgmailusername@gmail.com

When you press ' E ' to leave the settings screen, you will be reminded to save the changes. Once you have saved the changes, you can send the mail via Alpine immediately! To do this, go to the Compose option on the main menu, and then start working on your Gmail from the command line.

Summarize

In this post, we discussed how to access Gmail in a terminal environment through a lightweight and powerful command-line mail client named Alpine. Alpine is a free software release under the Apache Software License 2.0 protocol, which is compatible with the GPL protocol. Alpine is proud: it is not only friendly to the novice, but also to make the experienced system administrators think it is powerful. I hope that after you have read this article, you will realize how correct my last assertion is.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.