Using MAPI to force a send

I'm sending some email directly using the MAPISendMail interface, but (under outlook at least) this just drops the mail into the outbox.  Unfortunately, our program's data is time critical, and the email needs to be forced out immediately after being sent.

Is there a MAPI call that will force the mail program to send/recieve?  If not, is there at least one specific to outlook/outlook express?

LVL 11
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.

AFAIK MAPI relies on a MAPI client like Outlook and therefore on its settings. If you want to *directly* send an EMail, why not using SMTP, e.g.

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
KurtVonAuthor Commented:
If I have to, it's a possibility to switch.  Unfortunately we are sending multiple file attachments (the critical data) and I'm not sure how to manually encode those.

I'd also need a generalized way of finding the SMTP server the computer uses, since I don't think we can get away with asking the person installing the program to provide that information.

A definate possibility in the future, though.
Hmm, all I found was that this behaviour is controlled by the profile specified when calling 'MAPILogon()' and the flags - some people claim that using MAPI_FORCE_DOWNLOAD *should* alter that behaviour.
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

KurtVonAuthor Commented:
Nope.  It forces a download, but not an upload (at least in Outlook) unless I'm doing this wrong.  I'm logging into the current session with

    if (lpfnLogon != NULL)
        LHANDLE hSession;
        nError = lpfnLogon((ULONG)m_hParent, NULL, NULL, MAPI_FORCE_DOWNLOAD, 0, &hSession);

and yes, I've confirmed lpfnLogon is assigned correctly and returns 0.

And, unfortunately, like Daffy Duck, I can only perform this trick once:
KurtVonAuthor Commented:
Well, given how far these questions move down in a day, it's unlikely anyone is going to have a better suggestion, and SMTP will do pretty much what we need.  I found some examples of how to attach files, so I think I can wing it.

Thanks for the help.
Thank you!
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.