Solved

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

Posted on 2011-02-13
7
619 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:
ddsh79 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:ddsh79
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 14

Expert Comment

by:ddsh79
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:ddsh79
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
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…
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.

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now