Send mail from command line

April 4, 2013
linux command-line sendmail

Ever needed to send a mail from the command line. It’s pretty simple (provided you already have a mail transfer agent running such as postfix or sendmail).

echo “Type email content here” | mail -s “Your subject” -a attachement-filename.png [email protected]

Let’s say your account name on your PC is ‘user’ and machine name is ‘pc1’. The recipient will find the mail originating from something like [email protected] Mails replied to the latter won’t be receivable of course. You can therefore specify a reply-to address with the option -r.

echo “Type email content here” | mail -r [email protected] -s “Your subject” [email protected]

City Council of Barcelona switches from Microsoft Windows to Linux

February 11, 2018
linux ubuntu microsoft open source data protection

linux.com website compromised?

December 7, 2017
linux wordpress security

Linux Magazine's special edition on openSUSE

November 20, 2017
opensuse linux university-of-mauritius education