Exchange mails (sending + receiving) on not-logged-on account, VC++ 6.0

I need to log on to an Exchange server to check my Inbox, copy the content of the mails to a text file and move the mails into an archive folder. Also I must be able to send mails.

Big Problem: The exchange mail account belongs to another windows user account.

I am Administrator, have full rights and would (if needed) hardcode all login / password stuff for the mail account ("tsdp"). But I haven't managed yet, I guess i must first impersonate myself before I can operate. Or ? I have no exchange password, only the windows user account password, but did never manage to come into the mail account.

Do I have to add an additional mail profile in order that it works ?

I use Visual C++ 6.0 / Visual Basic 6.0, what technique would allow me the most technically-up-to-date stuff and flexibility ? (no, I mean  not ".NET" and not web service stuff like ADO)  CDO 1.2.1 ? Or some MAPI functions ? I need some code snippets that help me perform this task.
Who is Participating?
PAQed with points refunded (500)

Community Support Moderator
You should be able to specify any arbitrary Exchange user name when calling 'MAPILogon()' or 'MAPILogonEx()' independent from the Windows account you're using. See also the samples at and ("Sending and receiving e-mails from your program") in particular.
PC-AlexAuthor Commented:
Thanks for the tips, jkr, codeproject was also my first source to examine.

I just found out that the problem was due to missing rights on the exchange account: I am member of the Admin group, I am entitled to "send as" on this account, I had an additional mail profile for this box ... but that was not enough.

I had to make the check box in Active Directory Users und Computers, "View" / "Advanced Features", to be able to see "Exchange Advanced", where I can give me the "Permissions for tsdp". That was it.

I have documented the full details on (in german)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.