Operating System - HP-UX
1834455 Members
2886 Online
110067 Solutions
New Discussion

when use mail or sendmail to mail on comamnd line , how to attach a file ?

 
faust2004
Regular Advisor

when use mail or sendmail to mail on comamnd line , how to attach a file ?

thanks
Sunny
13 REPLIES 13
Stefan Farrelly
Honored Contributor

Re: when use mail or sendmail to mail on comamnd line , how to attach a file ?


uuencode | mailx -s""

or

uuencode | sendmail -v
Im from Palmerston North, New Zealand, but somehow ended up in London...
Rita C Workman
Honored Contributor

Re: when use mail or sendmail to mail on comamnd line , how to attach a file ?

Chris Vail
Honored Contributor

Re: when use mail or sendmail to mail on comamnd line , how to attach a file ?

We use email instead of lpr for one of our applications. The applications is inside the firewall, but our user is outside.

We use mutt as our mail agent. It is a 'mongrel' of a tool, combining both usenet and email into a single utility. It is well written and handy. http://www.mutt.org.

Its uses -a (attach) flag for its command line. Hence the command:
date|mutt -a SOMEFILE SOMEADDRESS attaches the file in a MIME compliant manner and emails it to the specified address, and the date will be in the text of the message.

Check it out.

Chris
Uday_S_Ankolekar
Honored Contributor

Re: when use mail or sendmail to mail on comamnd line , how to attach a file ?

Hi,

Try this,
usr/bin/uuencode file file |mailx -m -s "The Subject" email_id

Goodluck,

-USA..
Good Luck..
Deshpande Prashant
Honored Contributor

Re: when use mail or sendmail to mail on comamnd line , how to attach a file ?

HI
I use this way

/usr/bin/uuencode attach-file attach-file |mailx -m -s "The Heading for email"

You can send only one attachment at a time with this.

Thanks.
Prashant Deshpande.
Take it as it comes.
faust2004
Regular Advisor

Re: when use mail or sendmail to mail on comamnd line , how to attach a file ?

Hi , all,
Thanks for help.
i can not find unencode on the my machine (hp11.0), is it installed with the operation system. where to find it?

Sunny
Michael Tully
Honored Contributor

Re: when use mail or sendmail to mail on comamnd line , how to attach a file ?

Hi,

'uuencode' is part of the core operating
system. The binary itself can be found
in '/usr/bin/uuencode'
The man pages are located in
'/usr/share/man/man1.Z/uuencode.1 /usr/share/man/man4.Z/uuencode.4'

without quotes

HTH
-Michael
Anyone for a Mutiny ?
faust2004
Regular Advisor

Re: when use mail or sendmail to mail on comamnd line , how to attach a file ?

Thanks ,
I got it.

Sunny
faust2004
Regular Advisor

Re: when use mail or sendmail to mail on comamnd line , how to attach a file ?

Hi , all,
when I use: uuencode uucp|mailx -m -s "test" ys@oa_server , the command donot end.
when use :/usr/uuencode uucp |mailx -m -s "test" ys@oa_server, I got the mail, but the
attached file is 0 byte.
why?
thanks
Sunny
Michael Tully
Honored Contributor

Re: when use mail or sendmail to mail on comamnd line , how to attach a file ?

Hi,

Try this:

/usr/bin/uuencode /usr/bin/uucp /usr/bin/uucp | mailx -m -s "subject" user@domain.com

You need to make sure that you use the full path when specifying the file, and you must specify it twice.

HTH
-Michael

Anyone for a Mutiny ?
faust2004
Regular Advisor

Re: when use mail or sendmail to mail on comamnd line , how to attach a file ?

Hi, Michael,
I do as you say, now I can get the mail ,but the uucp is appear to be text, not a attched files. is it because the uucp is a binary file?

thanks
Sunny

Michael Tully
Honored Contributor

Re: when use mail or sendmail to mail on comamnd line , how to attach a file ?

Hi,

I'm not sure why it doesn't work, I was able
to get the same file as 56KB but windows did
not know what the file was which is what I
would have expected seeing it was a binary.
What did you get ?
In the attached link there is additional
information on the subject.

http://us-support3.external.hp.com/cki/bin/doc.pl/sid=524b67180a7fab72dd/screen=ckiDisplayDocument?docId=200000054887756

HTH
-Michael
Anyone for a Mutiny ?
faust2004
Regular Advisor

Re: when use mail or sendmail to mail on comamnd line , how to attach a file ?

Hi, michael ,

I use sendmail instead of mailx, and now , it is ok.

thanks all
Sunny