Solved

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

Posted on 2011-02-13
7
630 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 500 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

688 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