Operating System - Linux
1828630 Members
7482 Online
109983 Solutions
New Discussion

Re: In Linux, how to send a file as an attachment to our mail box

 
ezhilarasan_1
Occasional Advisor

In Linux, how to send a file as an attachment to our mail box


Hi,

In Linux, how to send a file as an attachment to our mail box.

In Unix, the following command works fine

unix2dos m | uuencode m.txt | mailx -s "Testing attachment mail" radhakrishnan.ezhilarasan@ubs.com

But in Linux, it is comming as empty file.
That means coversion is wrong.

Please help how to do this in Linux.


Regards
Ezhil
4 REPLIES 4
spex
Honored Contributor

Re: In Linux, how to send a file as an attachment to our mail box

Ezhil,

First, try the command again with 'mailx -m -s' ('-m'="MIME headers") substituted. If that doesn't work, verify that you have 'unix2dos' (or 'ux2dos') and 'uuencode' installed on your system, and that they are in your $PATH, and that you have permission to execute. Also make sure that you can send a different attachment directly from 'mailx'. Then build up the command slowly, incrementally testing each stage:

# unix2dos m | less

If that works, then:

# unix2dos m | uuencode m.txt | less

Then try sending the attachment to a local account:

# unix2dos m | uuencode m.txt | mailx -m -s "Testing attachment mail" root

Then:

unix2dos m | uuencode m.txt | mailx -m -s "Testing attachment mail" radhakrishnan.ezhilarasan@ubs.com

If this yields the same result, make sure that attachments aren't being corrupted/stripped by your mail gateway or your email client.

Finally, you can give SEP's famous mailfile attachment script a try:

http://www.hpux.ws/mailfile2

Good luck,

PCS
melvyn burnard
Honored Contributor

Re: In Linux, how to send a file as an attachment to our mail box

thread opened in wrong forum, moved to correct forum
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Alexander Chuzhoy
Honored Contributor

Re: In Linux, how to send a file as an attachment to our mail box

Below is an example:

echo "here comes a message that will appear in the body"|mutt -a filename_to_attach -s "message that will appear in the subject" email@address.com

Regards.
Dave La Mar
Honored Contributor

Re: In Linux, how to send a file as an attachment to our mail box

Ezhil -
Aside from other's comments, attached is an inhose doc on the use of mailx for HP-UX.
Not sure how Linux will interpret all and have never seen the command unix2dos. Though, as you'll see in the doc, we make extensive use of ux2dos.

Regards,

-dl
"I'm not dumb. I just have a command of thoroughly useless information."