Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Attach file in mailx command

Shell Programming and Scripting

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:
Attach file in mailx command Please use [CODE] tags when posting command lines, listings, ...

Last edited by pludi; 05-10-2011 at 07:17 AM..
Sponsored Links
Old Unix and Linux 05-10-2011
methyl methyl is offline Forum Advisor  
Join Date: Mar 2008
Last Activity: 8 June 2016, 9:58 PM EDT
Posts: 6,402
Thanks: 288
Thanked 676 Times in 645 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 07: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,521
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

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 06:04 AM
Can not attach using mailx ultimatix Shell Programming and Scripting 10 10-20-2010 09:14 AM
Mailx: How to send a attachment using mailx command Sriram.Vedula53 Shell Programming and Scripting 3 02-19-2010 04:12 AM
How to attach a file in Linux mail command rohit22hamirpur Shell Programming and Scripting 1 12-05-2008 12:58 AM
attach 2 files using mailx anumkoshy Shell Programming and Scripting 2 08-27-2007 01:37 AM

All times are GMT -4. The time now is 11:07 AM.