Solved

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

Posted on 2011-02-13
7
623 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
  • 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
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…
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.

776 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