How to attach a file to an email using command line in RHEL 5?
Environment
- Red Hat Enterprise Linux (RHEL) 5
Issue
- How can I attach a file to an email using command line in Red Hat Enterprise Linux 5?
Resolution
Either use mutt or pipe output from uuencode to mail
-
mutt-
yum install mutt -
echo "Message body here" | mutt -s "SUBJECT" -a "FILEPATH" -a "ANOTHERFILE" USER@DOM.TLD
-
-
uuencode+mail-
yum install sharutils -
uuencode "FILEPATH" "SHORTNAME" | mail -s "SUBJECT" USER@DOM.TLD-
In the command above, the
SHORTNAMEis arbitrary -- it is the filename that will be presented to the recipient -
For sending attachments in RHEL 6, see:
How to attach a file to an email using command line in RHEL 6?
-
-
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments