[Urgent!] Sending Email Problem in Solaris 9

I am using sendmail in Solaris 9 to send mail. The following is the command in my shell script:

cat <<EOF > tmp-mail.txt
MIME-Version: 1.0
From: $MAIL_FROM
To: $MAIL_TO
Subject: $SUBJECT
Content-Type: text/plain; charset="utf-8"

TEST Content

EOF

/usr/lib/sendmail -t -n < tmp-mail.txt

I have looked at the /var/adm/messages log, and found the following:
Apr 7 18:13:20 ziong sendmail[24754]: [ID 801593 mail.crit] NOQUEUE: SYSERR(abc): can not chdir(/var/spool/mqueue/): Permission denied
Apr 7 18:13:52 ziong sendmail[24818]: [ID 801593 mail.crit] NOQUEUE: SYSERR(abc): can not chdir(/var/spool/mqueue/): Permission denied

I am running the script as root, and the following is the permission of /var/spool/mqueue:

/var/spool:
dr-xr-x--- root bin mqueue

The sendmail daemon is started as root (checked by ps -ef | grep sendmail).

The problem is I cannot receive any email that is generated by my script. Can someone please help?

This question is very urgent, and need the solution ASAP. Thanks you very much.
LVL 16
Peter KwanAnalyst ProgrammerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

anfiCommented:
0) Which sendmail version do you use? [I suspect sendmail-8.12+ problem]
http://www.sendmail.org/faq/section4.html#4.16
Subject: Q4.16 -- How do I find sendmail's version number?

1) Is /var/spool/mqueue/ located on NFS mounted partition

*IF YOU USE sendmail-8.12+*
2) Do you have /etc/mail/submit.cf?
[ sendmail-8.12+ uses *TWO* cf file. submit.cf can be generated from submit.mc ]

Permissions for non set root id (default) installation of sendmail-8.12+ are described at
http://www.sendmail.org/secure-install.html
Peter KwanAnalyst ProgrammerAuthor Commented:
0) 8.12.0
1) No
2) We are using our own cf and mc files. Is this ok?
anfiCommented:
2) OK but you need submit.cf anyway (in default sendmail-8.12+ installation mode)

submit.cf provided by sendmail.org can be used without modifications in almost all sendmail-8.12+ istallations. It is responsible for transmitting locally submitted messages via 127.0.0.1:25 to main sendmail daemon running as root. It allowed to scrap need to installing sendmail as set root id (source of many security risks).

http://www.sendmail.org/secure-install.html
Artysystem administratorCommented:
sendmail is already setgid to smmsp, you don't need to change something
just use this command:

/usr/lib/sendmail -t -n -f uid < tmp-mail.txt

where uid is your solaris user name (from which mail is sent) it may be 'nobody'

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Peter KwanAnalyst ProgrammerAuthor Commented:
Thanks all for contribution. Both works.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Servers

From novice to tech pro — start learning today.