?
Solved

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

Posted on 2011-02-13
7
Medium Priority
?
633 Views
Last Modified: 2013-12-26
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
0
Comment
Question by:cghrmauritius
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 14

Accepted Solution

by:
Dushyant Sharma earned 2000 total points
ID: 34885866
$mail -s "Report 05/06/07" boss@yahoo.com < demo.txt

http://www.cyberciti.biz/faq/howto-write-command-to-send-receive-mail/
0
 
LVL 14

Expert Comment

by:Dushyant Sharma
ID: 34885868
here -s "report 05/06/07" is the subject
boss@yahoo.com is the address to send the mail
demo.txt is the file to be sent. in your case it will be /tmp/test.xml
0
 

Author Comment

by:cghrmauritius
ID: 34885892
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?
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 14

Expert Comment

by:Dushyant Sharma
ID: 34885916
0
 

Author Comment

by:cghrmauritius
ID: 34885982
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

./search_with_ref_input.sh: 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
0
 
LVL 14

Expert Comment

by:Dushyant Sharma
ID: 34886089
try this

email -s "this is subject" -a /tmp/test.xml user@domain.com < "Hey this is some body content"
0
 

Author Closing Comment

by:cghrmauritius
ID: 34887069
Tanks for your help in the end i used mutt as this was installed on the server and it serves the purpose
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Utilizing an array to gracefully append to a list of EmailAddresses
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month13 days, 21 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question