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
Who is Participating?
Dushyant SharmaConnect With a Mentor Commented:
$mail -s "Report 05/06/07" < demo.txt
Dushyant SharmaCommented:
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
cghrmauritiusAuthor Commented:
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?
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

cghrmauritiusAuthor Commented:
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
Dushyant SharmaCommented:
try this

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

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.