Email - Sendmail (Linux)


Sendmail is a mail transfer agent (MTA) for linux. It transfers electronic mail messages from one computer to another using SMTP

Almost all MTAs provide a sendmail interface.



/sbin/service sendmail restart



sudo apt-get install sendmail

Submitting mail

This documentation was tested with the sendmail of the postfix MTA.

You can set options at the command line, for instance -F (Set the sender full name) - They correspond to the smtp command.

Type a mail file for the smtp data (headers are separated from the body by a blank line)

Subject: Hello World !
From: nico
To: [email protected]

This is my first mail 

Excited I am
  • You can pipe it in to sendmail
sendmail [email protected] < mail.eml
cat mail.eml | sendmail [email protected]
  • or with a echo
echo -e "Subject:Hello World \n\n This is my first mail \n" | sendmail [email protected]
  • or enter the below command, type in your message, then press Enter and type in a dot and press Enter again.
sendmail [email protected]

Sending file attachments

Sendmail does not send mail attachments. You should encode your file using a MIME encoding utility before piping it to sendmail.

Documentation / Reference

Powered by ComboStrap