how to send mails to users on exchange server from sendmail/solaris(mailx)

Hi, Can anyone pls. tell me how to access Active directory from solaris. I am looking at solution by which I can send mail notification from the logs generated by scripts, to the users on Exchange server. I am trying for a Perl-LDAP module , but don't realy know how to go for it

I don't undersand what this has to do with AD. You should just be able to send the email to the full email addresses of the users and provided your mx records are correctly configured in dns it should get there.

In my script I am picking up the user IDs from /etc/passwd database.
Now this requirement then comes into picture to find out related mail address on the exchange server, for the user ID (derived from /etc/passwd database).
Is there any way by which I can resolve mail id for the user on unix box.

You could introduce your company's SMTP server and some creative /etc/hosts resolving on your SUNbox?

Our sendmail is configured w/the following options:
DMyourCOMPANY.com (masquerade company email address)
DSmail.COMPANY.com (this is the default route for all outgoing mail, which will be resolved in hosts file locally)

now in /etc/hosts, resolve mailCOMPANY.com by associating it w/your company's SMTP server (It will also include an alais for your exchange server domain).

192.x.x.x EXCHANGEdefaultDOMAIN.net mailCOMPANY.com

I believe it is this EXCHANGEdefaultDOMAIN.net entry that allows exchange to receive incoming mail. You will notice that it is recognized when performing a sendmail test (sendmail -v exchangeUSER@COMPANY.com).

no DNS, everything is resolved locally.

It would be much easier to use ldapsearch to get the correct email addresses for users.

Any Idea how to go for ldapsearch....a script.. something like that..?