Link to home
Create AccountLog in
Avatar of cghrmauritius
cghrmauritiusFlag for Mauritius

asked on

How can i simply email a file from within unix shell script please

Hi i would like to know how i can email the file /tmp/test.xml  from withing my shell script please, please note here i have very little knowledge of unix commands.

Thanks in advance
Avatar of Dushyant Sharma
Dushyant Sharma
Flag of India image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
here -s "report 05/06/07" is the subject is the address to send the mail
demo.txt is the file to be sent. in your case it will be /tmp/test.xml
Avatar of cghrmauritius


Hi thanks for the quick responce yes this did send me the email with the file as part of the body.

How do i get it to send the file as an attachment please instead of in the body?
sorry i know i'm a bit thick when it comes to unix commands and i hope you can be a bit more specific as i dont really understand those links

if i use the email command it says command not found

and if i use the uuencode i get

./ line 21: uuencode: command not found
Null message body; hope that's ok

please help with code rather than a link sorry to be a pest but i am a newby at unix
try this

email -s "this is subject" -a /tmp/test.xml < "Hey this is some body content"
Tanks for your help in the end i used mutt as this was installed on the server and it serves the purpose