email - C++ SimpleMAPI SendMail always fails? -


I'm trying to display a 'write message' dialog with an attachment on Vista SP1 which includes Windows Mail or A C + + app in Thunderbird (Borland C ++ Builder 2006). I should be able to use it to do this

I can not fill a recipient address because I hope that when the user will show the 'Write Message' dialog to the mail client, I also send a provider address Do not fill because I hope the mail client must use the default. I have tried hard to see if there is a problem and it is not so

My code looks like this:

  Histin HMAPI; LPMAPIS & MMail Payendand; Map message message; MapiFileDesc file; Zoramori (& amp; Message, Size (MapiMessage)); Zoramori (and file, size (MapiFileDesc)); HMAPI = Load Liberty ("MAPI32.DLL"); PSendMail = (LPMAPISANML) GETPROCODERES (HMAPI, "MAPISAndMail"); // Setup Attachments ... file.nPosition = -1; File.lpszPathName = "C: \\ my_attachment.dat"; // Set up the message ... message.lpszSubject = "My topic"; Message.lpszNoteText = "My message ..."; Message.lpszMessageType = ""; Message.nRecipCount = 0; Message.lpRecips = NULL; // We do not know the recipient address (message) message.nFileCount = 1; Message.lpFiles = & amp; File; Message.lpOriginator = NULL; // us do not know the user from dwResult = pSendMail (lhSessionNull, (DWORD) application-> handle, and message, MAPI_LOGON_UI | MAPI_DIALOG, 0); If (dwResult == SUCCESS_SUCCESS) {// ... yay! :)} and {// ... we always fail here: MAPI_E_FAILURE}  

it always fails with error code 2 (MAPI_E_FAILURE)

This may be of interest to you:

Do you have your email client has stopped?


Comments