Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Why don't you just use Simple MAPI like this:</p> <pre><code> HINSTANCE hlibMAPI; LPMAPISENDMAIL lpMAPISendMail; MapiMessage msg; MapiRecipDesc recipient, sender; hlibMAPI = LoadLibrary("MAPI32.DLL"); if (!hlibMAPI) { AfxMessageBox("Error while sending E-Mail: Can't load MAPI32.DLL"); return; } lpMAPISendMail= (LPMAPISENDMAIL)GetProcAddress(hlibMAPI, "MAPISendMail"); if (!lpMAPISendMail) { AfxMessageBox("Error while sending E-Mail: Can't locate function 'MAPISendMail' in 'MAPI32.DLL'"); return; } long l = 123456; unsigned long ul; sender.ulReserved = NULL; sender.ulRecipClass = MAPI_ORIG; sender.lpszName = "generic"; sender.lpszAddress = "SMTP:generic@sender.org"; sender.ulEIDSize = 4; sender.lpEntryID = &amp;l; recipient.ulReserved = NULL; recipient.ulRecipClass = MAPI_TO; recipient.lpszName = "dummy recipient"; char eadr[200]; strcpy(eadr, "SMTP:dummy@recipient.org"); recipient.lpszAddress = eadr; recipient.ulEIDSize = 4; recipient.lpEntryID = &amp;l; // setup message body msg.ulReserved = NULL; msg.lpszSubject = "sample subject"; msg.lpszNoteText = "sample text"; msg.lpszMessageType = NULL; msg.lpszDateReceived = "2013/10/31 00:00"; msg.lpszConversationID = NULL; msg.flFlags = MAPI_RECEIPT_REQUESTED; msg.lpOriginator = &amp;sender; msg.nRecipCount = 1; msg.lpRecips = &amp;recipient; msg.nFileCount = 0; /// &lt;-- use this to attach your file msg.lpFiles = NULL; // ul = (*lpMAPISendMail)(NULL, (ULONG)AfxGetMainWnd(), &amp;msg, MAPI_LOGON_UI, NULL); FreeLibrary(hlibMAPI); switch (ul) { case MAPI_E_LOGIN_FAILURE: AfxMessageBox("Error while sending E-Mail: Coldn't login"); return; case MAPI_E_INSUFFICIENT_MEMORY: AfxMessageBox("Error while sending E-Mail: There was insufficient memory to send the e-mail"); return; case MAPI_E_USER_ABORT: AfxMessageBox("User canceled mail creation"); return; case SUCCESS_SUCCESS: AfxMessageBox("E-mail was sent successfully"); break; default: AfxMessageBox("Unknown error while sending E-Mail"); return; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload