Configuring methods for sending Internet mail using mail under Linux systems

Source: Internet
Author: User
Tags mail

Users who are accustomed to Windows systems may initially have a bad grasp of the Linux system, and many features may not be used very well. This article introduces a small application of Linux systems: Use mail to send Internet Mail under Linux. But before I introduce mail, let's take a look at the SendMail service.

The SendMail service on Red hat is typically started automatically. You can view the status of the SendMail service by using the following command:

Service SendMail Status

If the SendMail service is not started, you can start with the following command:

Service SendMail Start

"Note" Every time you modify the network configuration (such as modify IP, host name, etc.), you must restart the SendMail service, or send mail will fail.

The simplest form of syntax for sending Internet mail using mail commands is:

Mail username@address

The following is a simple example of sending a message:

Subjiect: Is the subject of the message

Below is the body of the message

"Note" Here cc: is the actual result of pressing the CTRL+D key, does not belong to the mail content

To check whether a message is sent successfully, you can use the following command:


If the "/var/spool/mqueueisempty" message is displayed, the message is sent successfully. Open your own mailbox to see it!

If another error message is displayed, the message must be sent unsuccessfully. What do we do? You will normally need to restart the SendMail service.

This is the reason why I mention sendmail service.

If you want to use the contents of a text file as the content of an e-mail message, you can do so by using the following command:

Mail-s "Subject" username@address


Catfilename|mail-s "Subject" username@address

Parameter-s indicates the subject of the message

For example:

Mail-s "Atestmailfile"

The Mail command cannot send attachments, and if you are sending attachments, it is recommended that you install the RPM package for the Mutt mail client.

Use the-a parameter to specify the attachment, and the other parameters are similar to the Mail command:

For example:

Mutt-s "Testmutt"-a/root/

Mutt is a very powerful software.


I hope this article describes how you can use mail to send Internet mail in a Linux system that helps readers. More knowledge about Linux systems remains to be explored and studied by readers.

Related Article

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: 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.