Unix/Linux Go Back    

Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

Attach file in mailx command

Shell Programming and Scripting

Closed Linux or Unix Question    
Thread Tools Search this Thread Display Modes
Old Unix and Linux 05-10-2011
Himanshu_soni Himanshu_soni is offline
Registered User
Join Date: Jan 2011
Last Activity: 10 May 2011, 9:08 AM EDT
Posts: 17
Thanks: 4
Thanked 0 Times in 0 Posts
Attach file in mailx command

I want ot send a mail with aatach a file for this i have tried

mailx -s "COMPLETED: deal.sh" -a root/usr/local/bin/sched/nightly_Cronjob/test.out me@nowhere

uuencode /usr/local/bin/sched/nightly_Cronjob/test.out /usr/local/bin/sched/nightly_Cronjob/test.out | mailx -s "COMPLETED: deal.sh" me@nowhere

but of command is not working. so is there any otner way to send a mail with attachment.

Thanks in advance

Moderator's Comments:
Please use [CODE] tags when posting command lines, listings, ...

Last edited by pludi; 05-10-2011 at 08:17 AM..
Sponsored Links
Old Unix and Linux 05-10-2011
methyl methyl is offline Forum Advisor  
Join Date: Mar 2008
Last Activity: 3 October 2015, 8:20 PM EDT
Posts: 6,400
Thanks: 288
Thanked 675 Times in 644 Posts
uuencode /usr/local/bin/sched/nightly_Cronjob/test.out /usr/local/bin/sched/nightly_Cronjob/test.out | mailx -s "COMPLETED: deal.sh" me@nowhere
First reaction is to give the attachment a valid MS-DOS name.

uuencode /usr/local/bin/sched/nightly_Cronjob/test.out myattach.txt | mailx -s "COMPLETED: deal.sh" me@nowhere

And to consider converting the attachment to MS-DOS format.

ux2dos /usr/local/bin/sched/nightly_Cronjob/test.out | uuencode myattach.txt | mailx -s "COMPLETED: deal.sh" me@nowhere

Failing that, please mention what Operating System and Shell you are using and describe what happens.

Does mailx without an attachment work?
What mail reader are you using?

Last edited by methyl; 05-10-2011 at 08:41 AM..
Sponsored Links
Old Unix and Linux 05-10-2011
pludi's Unix or Linux Image
pludi pludi is offline Forum Advisor  
Cat herder
Join Date: Dec 2008
Last Activity: 28 March 2014, 8:35 AM EDT
Location: Vienna, Austria, Earth
Posts: 5,522
Thanks: 38
Thanked 335 Times in 308 Posts
This question has been asked so often it has it's own FAQ section here. Please use the search feature first, especially for questions that everyone sooner or later encounters.
The Following User Says Thank You to pludi For This Useful Post:
Himanshu_soni (05-10-2011)
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to split a csv file and zip it and attach using mutt command? Jassz Shell Programming and Scripting 0 01-03-2011 07:04 AM
Can not attach using mailx ultimatix Shell Programming and Scripting 10 10-20-2010 10:14 AM
Mailx: How to send a attachment using mailx command Sriram.Vedula53 Shell Programming and Scripting 3 02-19-2010 05:12 AM
How to attach a file in Linux mail command rohit22hamirpur Shell Programming and Scripting 1 12-05-2008 01:58 AM
attach 2 files using mailx anumkoshy Shell Programming and Scripting 2 08-27-2007 02:37 AM

All times are GMT -4. The time now is 02:56 AM.