mail command (also mailx command) is an intelligent mail processing system under Unix and Linux. You need to use the following syntax to send an email using mail command:
Where,
mail -s 'Subject-Here' you@cyberciti.biz < input.file
mail -s 'Uptime Report' you@cyberciti.biz < /tmp/output.txt
- -s 'Subject' : Specify subject on command line.
- you@cyberciti.biz: To email user.
- /tmp/output.txt : Send the content of /tmp/output.txt file using mail command.
Send an email as attachment from Unix command line
Either can use the mutt command or uuencode command as described below:OR
### Attach /tmp/filelist.tar.gz and read the content of a text using /tmp/body.txt ###
mutt -s "Backup status" -a /tmp/filelist.tar.gz you@cyberciti.biz < /tmp/body.txt
### Attach /tmp/list.tar.gz and and send it ###
uuencode /tmp/list.tar.gz /tmp/list.tar.gz | mailx -s "Reports" user@eu.corp.cyberciti.biz
### Email photo.png along with a text message read from body.txt ##
(cat body.txt; uuencode photo.png photo.png) | mail -s "Subject" user@cyberciti.biz
No comments:
Post a Comment