1835242 Members
2167 Online
110078 Solutions
New Discussion

mailx

 
SOLVED
Go to solution
j773303
Super Advisor

mailx

How to use mailx to attached file forward to users?
Hero
9 REPLIES 9
Michael Tully
Honored Contributor
Solution

Re: mailx

Try this:

$ for e in `echo file1 file2 file3`
> do
> uuencode $e $e.txt
> done | mailx -m -s "mymail" username@domain.com

Change the ".txt" to the proper format of the file e.g. .xls for excel
Anyone for a Mutiny ?
j773303
Super Advisor

Re: mailx

Do you have any other sample if I don't want to uuencode command? How to modify this script? I just want to send ascii file.
Hero
Michael Tully
Honored Contributor

Re: mailx

Unfortunately 'uuencode' is highly recommended and in most cases quite necessary. You can use it with or without files that have extension names (suffixes)
Suggest you have a look at some postings that have more ideas. There are quite a number.

Search suggestion:
mailx + attachment
Anyone for a Mutiny ?
Steven E. Protter
Exalted Contributor

Re: mailx

I'm attaching a sendmail script that does attachments pretty well.

Attaching it.

It can be worked quite nicely into Michael's loop and doesn't use uuencode

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Michael Schulte zur Sur
Honored Contributor

Re: mailx

Hi SEP,

if it doesnt use uuencode, whats this?
uuencode $attfile $flename >> $fmesg

greetings,

Michael
Steven E. Protter
Exalted Contributor

Re: mailx

Darn,

I forgot about that line.

Thanks for keeping me honest.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Geoff Wild
Honored Contributor

Re: mailx

Another cool utility is mpack

You can get it from the HP-UX Porting Centre:

http://hpux.ee.ualberta.ca/hppd/hpux/Users/mpack-1.5/

"Mpack and munpack are utilities for encoding and decoding
(respectively) binary files in MIME (Multipurpose Internet Mail
Extensions) format mail messages."

mpack -s subject filetoattach youremail@yourdomain.com

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Tim Sanko
Trusted Contributor

Re: mailx

Not that I am less than a critic, but isn't mpack on hpux also going to use uuencode...

Tim
Geoff Wild
Honored Contributor

Re: mailx

Tim, you are right - in that case,

mailx -s "your subject" yourid@yourdomain.com < yourfile

That will NOT attach the file - but it doesn't uuencode...

Not too sure why uuencode is being frowned upon....

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.