Send mail from command line

Sending mail directly from a Linux server can often be handy. Here is how I do it

Send mail

cat "Test" | mail -s "Test subject"

This will send a mail with the message “Test” and subject line “Test subejct” to email adress:

Send attachments

mutt -s "Attachment subject" -a attachment.jpg

This will open up your favorite editor so you can create a mail message to your attachment. After you save and exit the editor you just press ‘y’ to send the message with the attachment (you will be inside Mutt then)

Tested on RHEL 3

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">

This site uses Akismet to reduce spam. Learn how your comment data is processed.