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.

Syntax:

# sendmail admin@emp.com < /tmp/email.txt

2. Mail command:

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

Syntax:

# mail –s “subject” admin@emp.com < /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.

Syntax:

# mutt – s “email for server” admin@emp.com < /dev/null

You can send email with attach file using given command.

Syntax:

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

4. SSMTP command:

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

Syntax:

# ssmtp admin@emp.com

Subject: send mail to SSMTP server

^d

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.

Syntax:

# telent localhost smtp
Author
Jaishree
Views
9,453
First release
Last update
Rating
0.00 star(s) 0 ratings
Top