issue with mailing

hi i run a mailing script daily
using rsh

i receive the mail sometimes but sometimes receive the permission denied
error.

could not understand the cause of permission denied because it sometimes runs properly and i am able to receive the mail

Please Advice

The full text of the permission denied message would help to see what is denying permission.

It's not clear what your script is doing.
You say you receive mail, so are you fetching mail, maybe via POP?
Is it your own personal mail, or are you a system admin with root access?
Are you calling a command line mail utility like mail, mailx, or nail? Or some other software?
Are you using a shell script or perl or something else?

I have mail questions too, so I'm interested in what you are trying to do.

rsh servername mailx -s $1 $2

$1 and $2 are subject and attachment i am sending across

i am getting the error
rshd: 0826-813 Permission is denied.

Now the issue is it happens only sometimes and sometimes i receive the mail with attachment correctly.

Where's the destination address? The mailx portion of the command line should be something like this:

mailx -s subject -a attachment address

So the $2 should be the destination address. If you want it to be an attachment, put -a in front of it.

Also, the attachment file will have to be on the remote server for it to work that way.

I haven't tried this with rsh, but it should work. Pass the text of the email to stdin.

cat message.txt | rsh server mailx -s subject user@server