Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Linux - Send Email with Attachment from CLI

Install necessary packages

sudo apt-get install mutt postfix -y

Send the Email

echo "This is the message body" | \
  mutt -a "/path/to/file.to.attach" \
  -s "subject of message" \
  -- recipient@domain.com

References

Last updated: 4th January 2023
First published: 16th August 2018