Operating System - HP-UX
1823058 Members
3071 Online
109645 Solutions
New Discussion юеВ

How to send a file as attachment from Unix to Outlook ?

 
SOLVED
Go to solution
ezhilarasan_1
Occasional Advisor

How to send a file as attachment from Unix to Outlook ?


Hi,

How to send a file as an attachment from Unix to Outlook.

I use the command mailx , but it is not comming as an attachement, rather the whole file is comming as body of the mail.

How to send a file as attachment from Unix to Outlook. Please help for this.

Thanks
Ezhil

12 REPLIES 12
Patrick Wallek
Honored Contributor

Re: How to send a file as attachment from Unix to Outlook ?

I use the following:

(echo "Subject: Whatever you want" ; uuencode /dir/filename /dir/filename) | /usr/sbin/sendmail someone@somewhere.com


Note the the /dir/filename in the uuencode part of the command is the exact same /dir/filename twice. That is intentional.
James R. Ferguson
Acclaimed Contributor
Solution

Re: How to send a file as attachment from Unix to Outlook ?

Hi Ezhil:

Since good old Windows insists on lf/cr line terminators instead of newlines, I strip the carriage-returns out of the file and then send it like this:

# ux2dos /etc/hosts > /tmp/hosts.txt
# uuencode /tmp/hosts.txt /tmp/hosts.txt | mailx -m -s "Here it is!" whoever@whereever.com

Regards!

...JRF...

Dave La Mar
Honored Contributor

Re: How to send a file as attachment from Unix to Outlook ?

Ezhil-
Attached is a host of options using mailx.

Best of luck.

Regards,

dl
"I'm not dumb. I just have a command of thoroughly useless information."
Raj D.
Honored Contributor

Re: How to send a file as attachment from Unix to Outlook ?

Hi Ezhil,

To send an attachment from unix to your Outlook mail id do as following:

File Name= file1.txt

# uuencode file1.txt file1.txt | mailx -s "Directly sending from unix host" yourmailid@domain.com

Enjoy,
Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Sandman!
Honored Contributor

Re: How to send a file as attachment from Unix to Outlook ?

In case a lot of files need to be sent as an attachment, then its best to tar them up and email them as an attachment. tar'red files attached in Outlook can be extracted and viewed with WinZip:

# tar cvf

# uuencode | mailx -m -s "my files"

regards!
Joseph Loo
Honored Contributor

Re: How to send a file as attachment from Unix to Outlook ?

hi ezhil,

refer to this KB:

http://www1.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000079993924

regards.
what you do not see does not mean you should not believe
Yogeeraj_1
Honored Contributor

Re: How to send a file as attachment from Unix to Outlook ?

hi Ezhil,

i use:

/usr/bin/uuencode $youfile "TryThis.lis"|mailx -m -s "`hostname`- Try This ok - `date`" $emailadd

where
$emailadd is your email address
$yourfile is the file you want to send

hope this helps too!

regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Mel Burslan
Honored Contributor

Re: How to send a file as attachment from Unix to Outlook ?

Well, the command

uuencode myfile myfile | mailx -m -s "Attached file name=myfile" user@domain.com

was working for me up until few weeks ago. When I tried it last wednesday night to send a depot file to myself at my gmail.com address, all I got was the uuencoded text. As if it did not take the -m (suppress mime headers) switch.

Does anyone have any idea what might have changed ?
________________________________
UNIX because I majored in cryptology...
Luk Vandenbussche
Honored Contributor

Re: How to send a file as attachment from Unix to Outlook ?

Hi,

I am using the email client mutt for this

http://hpux.connect.org.uk/hppd/hpux/Networking/Mail/mutt-1.5.9/

This is a script to send mail with mutt

DESTIN=your.email@company.com
SUBJECT="mail from unix server"
ATTACH1="/etc/passwd"
ATTACH2="/etc/hosts"
TEXTFILE=/etc/inittab

/usr/local/bin/mutt -a "$ATTACH1" -a "$ATTACH2" -i "$TEXFILE" -s
"$SUBJECT" $DESTIN << EOF >/dev/null 2>&1
EOF

You don't need to work with uuencode and uudecode
Arunvijai_4
Honored Contributor

Re: How to send a file as attachment from Unix to Outlook ?

Hi,

We use pine as our mail client and its very good in its own features and security. It is avaialable from http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=HPUXIEXP1111

and FAQ for attachments,
http://www.washington.edu/pine/faq/attachments.html#top

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Fred Martin_1
Valued Contributor

Re: How to send a file as attachment from Unix to Outlook ?

Much has been written in this forum about this subject. I found here, some years ago, the script written by Dave Wotton that I've attached. Works very well. I keep it in my /usr/local/bin directory and use it often.

Also see:
http://home.clara.net/dwotton/unix/mail_files.htm

Fred
fmartin@applicatorssales.com
Manuel Contreras
Regular Advisor

Re: How to send a file as attachment from Unix to Outlook ?

We used to use uuencode...until we found mutt.

works like a charm:

echo "this is the attachment" > attachment.file

echo "this is the body" > body.file

/usr/local/bin/mutt -a attachment.file -b blindcopy@hotmail.com -s "this is the subject" email@address.com < body.file

If you do not have a body message/text, substitute with "/dev/null"


try it, you'll like it.


http://hpux.connect.org.uk/hppd/hpux/Networking/Mail/mutt-1.5.9/