Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the Alpine tool to access Gmail from the command line in Linux

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "how to use the Alpine tool to access Gmail on the command line in Linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

In this post, I will show you another beautiful and capable use case of the Linux command line: accessing Google's Gmail service, for which we will use Alpine, a multi-functional command line mail client based on ncurses (not to be confused with Alpine Linux). We will configure Gmail's IMAP and SMTP settings in Alphine to receive and send mail in the terminal environment through 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 already many excellent GUI-based mail clients, such as Thunderbird, Evolution, or even Web interfaces, so why is anyone interested in using command-line mail clients to collect Gmail? The answer is simple. If you need to deal with things quickly and want to avoid wasting unnecessary system resources, or if you are working on a streamlined installation without a console, which does not have an X service installed for graphical display; or the X service crashes on your desktop, and you need to send some emails urgently before solving the problem. In all of the above cases, Alpine can come in handy and meet your needs at any time.

In addition to simple editing, sending and receiving text-based email messages, Alpine can also encrypt, decrypt and digitally sign email messages, as well as seamlessly integrate with TLS (Transport Layer Security, transport layer encryption).

Install Alpine on Linux

On Red Hat-based distributions, you can install Alpine as follows. It is important to note that on RHEL or CentOS, you need to enable the EPEL software repository first.

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 will create a mail folder (~ / mail) under the current user's home directory and display the main interface, as shown in the following video: YOUTUBU Video-http://www.youtube.com/kuKiv3uze4U.

Its user interface has the following modules:

Please feel free to browse and operate to familiarize yourself with Alpine. You can always return to the command prompt interface at any time by typing'Q'. Note that there is help related to the operation at the bottom of all character interfaces.

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

The code is as follows:

# alpine-conf > / etc/pine.conf

Configure Alpine to use the Gmail account

When you have installed Alpine and spent at least a few minutes familiarizing yourself with its interface and menus, here is the time to actually configure it to use an existing Gmail account.

Before performing the following steps in Alpine, remember to enable the IMAP protocol in your Gmail settings through your Web email interface. Once IMAP is enabled in your Gmail account, perform the following steps to enable the ability to read Gmail messages in Alpine.

First, start Alpine.

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

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

Nickname: fill in any name you want

The code is as follows:

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

You can leave Path and View blank.

Then press Ctrl+X and enter your Gmail password when prompted:

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

To verify, you can compare the "Gmail Sent" mailbox displayed in Alpine with the mailbox under the Web interface:

By default, it automatically checks for new emails or prompts every 150 seconds, you can change this value in the file / etc/pine.conf, and you can change many other settings. This configuration file has detailed and clear comments. For example, to set the interval for checking new messages 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 a SMTP server to send mail over Alpine. Go back to the Alpine settings interface explained earlier, and then press'C'to set a SMTP server address for Google. You need to edit the line SMTP Server (for sending email) as follows:

The code is as follows:

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

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

This is the end of "how to use the Alpine tool in Linux to access Gmail on the command line". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report