Linux Sendmail Command Line - Examples

Linux Sendmail Command Line - Examples

Sendmail is the SMTP server that is used to send mail via command line. Sendmail command is mostly used by Linux/Unix distributer. With help of sendmail you can send mail via our Cronjob, shell script etc. we define different ways to send e-mail via command line as follow. You can choose the one of them for sending the e-mail via command line in Linux.

1. Sendmail Command:

You can send the email via command line by simply using the ‘sendmail’ command. For send the e-mail via Sendmail command first you need create file and add the given content.

# cat /tmp/mymail.txt/

Subject : server are not responding

Email content Line1

Email content Line 2

Subject: define the sending mail subject.

After that you can send the email using the given command.


# sendmail < /tmp/email.txt

2. Mail command:

You can also send the email via using the mail command in Linux system.


# mail –s “subject” < /dev/null

-s: s option is used to describe subject.

-a: a option is used for attachment.

3. Mutt command:

The mutt command is used to read emails on terminal of linux. You can also read emails from other server like IMAP/POP.


# mutt – s “email for server” < /dev/null

You can send email with attach file using given command.


# mutt “email for server” – a /opt/myarticle.sql < /dev/null

4. SSMTP command:

Ssmtp command is used to send the email from SMTP server.


# ssmtp

Subject: send mail to SSMTP server


5. telent command:

telent command is used by system administrator to test the connectivity of remote port. with the help of this command you can troubleshoot problems of sending email.


# telent localhost smtp
First release
Last update
0.00 star(s) 0 ratings