1832891 Members
2506 Online
110048 Solutions
New Discussion

Attachment with mailx

 
Luis Montañés
Occasional Contributor

Attachment with mailx

Can I send an attachment using mailx from the command line.

Thanks in advance.
9 REPLIES 9
Abhijit P.
Valued Contributor

Re: Attachment with mailx

Hi...

Here is the sysntax for attaching the file thrugh mailx ---sendmail....

uuencode filename.txt filename.txt | mailx -m -s "Message Subject"

Regards,
Abhijit
Geoff Wild
Honored Contributor

Re: Attachment with mailx

I prefer using Mpack:

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

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

Run it like so:

/usr/local/bin/mpack -s "svr004 cfg2html" svr004.html gwild@mydomain.ca


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.
Dave La Mar
Honored Contributor

Re: Attachment with mailx

Luis -
Posted many times. Please see attached examples.

Regards,

dl
"I'm not dumb. I just have a command of thoroughly useless information."
Steven E. Protter
Exalted Contributor

Re: Attachment with mailx

Shalom Luis,

Possible, but easier with sendmail.

http://www.hpux.ws/mailfile2

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 Skora
Advisor

Re: Attachment with mailx

This works for us:

(cat /home/bodytext.txt; uuencode /home/attachment.txt
/home/attachment.doc | mailx -s SUBJECT-LINE -r from.name@company1.com to.name@company2.com

Note: no white space allowed in the -s parameter. Best of luck.
Arturo Galbiati
Esteemed Contributor

Re: Attachment with mailx

Hi Luis,
just a note.
Take care that with last Outlook patch you could not be able to see the attchmnet in a correct way.
See this thread for more info:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1004490&admit=-682735245+1140770287286+28353475

HTH,
Art
Arturo Galbiati
Esteemed Contributor

Re: Attachment with mailx

Hi Luis,
please, remember to assign point who spent time and affort helping you. It's only a bit thing but really appreciated.
Art
Yogeeraj_1
Honored Contributor

Re: Attachment with mailx

hi,

in script we generally, use the following technique:

export LOG_PATH=/home/logger/db/logfiles
export dt=`date +%Y-%m%d`
export emailadd1="user3@mysvr.mu"
#
###Commands


##
/usr/bin/uuencode $LOG_PATH/myprocess"$dt".log "proc.log"|mailx -m -s "This is the Log for - `date`" $emailadd1
#
# End



you may use it at the command line level as well.

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Eberhard Maehr
Occasional Advisor

Re: Attachment with mailx

Hi Luis,

I had the same problem and decided to use the program nail instead of mailx.
You can download it from the HP-UX proting archive
http://hpux.asknet.de/hppd/hpux/Networking/Mail/nail-11.25/
and it's fairly simple to install and use.
example:
nail -s "test for nail" -a file_to_attach your_address@your_server

Regards
Eberhard