There are different approaches to send messages from the command line yet here, I am sharing a couple of choices utilized by general clients. You can utilize any choice given underneath to send email from Linux command line.

1. Sendmail

Sendmail is a most prominent SMTP server utilized as a part of the majority of Linux/Unix appropriation. Sendmail permits sending email from command line.

Use underneath guidelines to send email utilizing ‘sendmail’ command.

Make a record utilizing the following substance.

[root@testadmin ~]# cat /tmp/email.txt

Subject: Terminal Email Send

Email Content line 1
Email Content line 2

Subject line will be used as the subject for email.

Utilize the accompanying command to send the email.

[root@testadmin ~]# sendmail < /tmp/email.txt

2. Using ‘mail’ Command

Mail command is the most well-known command to send messages from Linux terminal. Utilize few of underneath cases to send an email.

[root@testadmin ~]# mail -s “Test Subject” < /dev/null

“-s” is utilized for characterizing subject for the email.

Likewise, we can send the email with a connection.

# mail -a /opt/backup.sql -s “Backup File” < /dev/null

Sometimes you may face the issue: Bash: mail: command not found

“-a” is utilized for connections.

Likewise, we can add comma isolated messages to send the email to various beneficiaries together.

# mail -s “Test Email”, < /dev/null

3. Using ‘mutt’ command

Mutt is essentially utilized for perusing sends from Linux terminal from neighborhood client letter boxes, additionally helpful to peruse messages from POP/IMAP servers. Mutt command is minimal like mail command. Utilize few of examples cases to send email.

# mutt -s “Test Email” < /dev/null

Send email including attachment
# mutt -s “Test Email” -a /opt/backup.sql < /dev/null

4. Using ‘SSMTP’ Command

SSMTP enables clients to send messages from SMTP server from Linux command line. For instance to send an email to client utilize the following command.

Presently type your subject of the email as beneath with catchphrase Subject. After that compose your message to sent to the client, After completing your message press
CTRL+d (^d) to send the email.

# ssmtp
Subject: Test SSMTP Email
Email send test using SSMTP
via SMTP server.

5. Using ‘telnet’ Command

In my experience, all framework chairmen utilize telnet command to test remote port network test or log in to the server remotely. A large portion of a beginner in linux doesn’t realize that we can send email utilizing telnet likewise, which is a better approach to investigate email sending issues. The following is a case of sending email.

Blue marked text is the user input and remaining is the responses of that commands.

# telnet localhost smtp

Connected to localhost.localdomain (
Escape character is ‘^]’.
220 ESMTP Sendmail 8.13.8/8.13.8; Tue, 22 Oct 2013 05:05:59 -0400
Good Morning
250 Hello [], pleased to meet you
mail from:
250 2.1.0… Sender ok
>rcpt to:
250 2.1.5… Recipient ok
354 Enter mail, end with “.” on a line by itself
This email is for testing purpose
250 2.0.0 r9M95xgc014513 Message accepted for delivery
221 2.0.0 closing connection
Connection closed by foreign host.

[tagline_box backgroundcolor=”description=” shadow=”no” shadowopacity=”0.7″ border=”1px” bordercolor=”” highlightposition=”top” content_alignment=”left” link=”” linktarget=”_self” modal=”” button_size=”” button_shape=”” button_type=”” buttoncolor=”” button=”” title=”” description=”If you have any queries on how to access email clients via command line in linux feel free to leave us a message and our representative will get back to you.

” margin_top=”50px” margin_bottom=”” animation_type=”slide” animation_direction=”left” animation_speed=”0.3″ class=”” id=””]