i am on hp-ux 11.23...i am trying to send an email as an attachement but it dose not seem to work...after reading on google i found that we can use uuencode to send file at attachement...here is my file and the syntax
but now here is the problem...i do get and email with subject line as "TEST VIEW AUTOMATION"
but do not get a atttachment...get some garbage (lol) in the body as below...
begin 644 test.txt
M"DY!344@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
M("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@"BTM+2TM+2TM
M+2`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
M("`@("`@("`@("`@("`@("`@("`@("`@("`@"D--1$)44U0@("`@("`@("`@
M("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
4("`@("`@("`@("`@("`@("`@"@H@
`
end
You are making the entire body of the email, the attachment. If you edit the received email and input the body to uudecode, you will get your original text.
Search "email attachment" in this forum, there are lots of examples.
Here's an example I did for some folks at work (ksh on Solaris). It sends the same file as 2 attachments just to show how it's done.
Create a text file by doing this:
who > example.txt
then run this script called mailtest:
#!/bin/ksh
##
## mailtest - example to show how to do attachments.
##
# set the body of the message.
MAILBODY="This is the body of the e-mail"
# If an ascii file, convert CR/LF so it will open properly in Outlook.
unix2dos -437 -ascii example.txt attach.out
(print $MAILBODY; uuencode attach.out example.txt; uuencode attach.out example1.txt) | \
mailx -s "mail example 2 attachments" <user>@<domain.com>
if (( $? != 0 ))
then print "$0: uuencode or mailx failed"
exit 3
fi
exit 0
You will get an e-mail with the same file attached twice.
Note that "test.txt" in the "uuencode" command is just the name by which the mail reader will see the file attachment. It needs to be ".txt" if you want to be able to open it automatically with Windows Notepad.
Btw. I think your "fromuser" and "touser" are reversed.