MSMAIL Interface


We have Microsoft Mail Exchange server.
On Windows Client, we have MSExchange32 installed. From that windows client, using MAPI calls, we would like to send E - Mails without any user interface.

Currently we have achived this but it expects that user should have already opened MsExchange32.exe and logged into it with a user profile. After that we are able to send any number of e - mails from our program without any user interface.
Is it to possible to avoid logging into MSExchange?
How can I do it? Where can I find information regarding this.


Who is Participating?
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.

Why not to use account name/password in MAPILogon() call?

You always need to login to be able to use MAPI (to send mail).
You can do this without user interface if you know the name of the profile yoy login with. Eg:

// remember to check for error ruturn codes!!!!!!
MAPILogon(hWnd, "Profile Name", "Password", 0, 0, &lhMAPISession);
MapiMessage MAPIMsg;
// fill out MAPIMsg here!!!
MAPISendMail(lhMAPISession, 0, &MAPIMsg, 0, 0);
MAPILogoff(lhMAPISession, 0, 0, 0);

If you don't know the profilename it is a problem. However you can write some code that creates a profile, then use that profile and the delete it again. I know how to do this, but never tired it.
See info on IProfAdmin.

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
coolbej1Author Commented:
Thanks a lot. We were using same APIs but still it was not working. We found that problem was because of different domains, one for login and a separate domain for Mailserver. Once we made these two domains same, problem was resolved.

Thanks a lot again
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
Microsoft Development

From novice to tech pro — start learning today.