Hi ,

I've been working with this for days now and searched high and low for an answer.

I'm using the MS Simple MAPI vc++ example to send out an email. Thing is, if I don't specify any flags using MAPISendMail then there's no user interaction (as expected) but the email was not responded. I have to manually send/receive to make the email disappear.
However if I set the MAPI_DIALOG flag via MAPISendMail, hitting Send via the subsequent dialog causes the message to be sent ok i.e. all is well using this method.

Any ideas on why a non-user interaction style approach not working.
iam using both outlook and outlook express.

my code is

#include <windows.h>

#include <stdio.h>

LPMAPILOGON lpfnMAPILogon;

LPMAPISENDMAIL lpfnMAPISendMail;

LPMAPILOGOFF lpfnMAPILogoff;

MapiRecipDesc recipient =

{

0, MAPI_TO,

"Chandu", "SMTPchandu00@yahoo.co.in",

0, NULL

};

MapiMessage message =

{

0, "Greetings",

"Hello, hw ru!\n",

NULL, NULL, NULL, 0, NULL, 1, &recipient, 0, NULL

};

void main(void)

{

LHANDLE lhSession;

//HANDLE hMAPILib;
HINSTANCE hMAPILib;


hMAPILib = LoadLibrary("MAPI32.DLL");

lpfnMAPILogon = (LPMAPILOGON)GetProcAddress(hMAPILib, "MAPILogon");

lpfnMAPISendMail = (LPMAPISENDMAIL)GetProcAddress(hMAPILib, "MAPISendMail");

lpfnMAPILogoff = (LPMAPILOGOFF)GetProcAddress(hMAPILib, "MAPILogoff");

//(*lpfnMAPILogon)(0, NULL, NULL, MAPI_ALLOW_OTHERS, 0, &lhSession);
(*lpfnMAPILogon)(0, NULL, NULL,0, 0, &lhSession);


//(*lpfnMAPISendMail)(lhSession, 0, &message, 0, 0);
int var = lpfnMAPISendMail(lhSession, 0, &message, 0, 0);
if(var==0)
printf("sucess");


(*lpfnMAPILogoff)(lhSession, 0, 0, 0);

printf("Message to the White House sent.\n");

FreeLibrary(hMAPILib);

}

i tried almost all flags in both logon and sendmail....but every time it displays the userinteraction window to send the mail....but iwant to send a mail without userinteraction.....

All help appreciated!