Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
mapimail.cpp File Reference
#include <windows.h>
#include <windowsx.h>
#include <string.h>
#include <mapi.h>
#include <stdlib.h>
#include "port.h"
#include "resource.h"

Go to the source code of this file.

Functions

void DoMAPIFreeBuffer (HWND hWnd, LPVOID buf, BOOL alert)
void ShowMessage (HWND hWnd, LPSTR msg)
void DoMAPISendMail (HWND hWnd)
void DoMAPISendDocuments (HWND hWnd)
void DoMAPISaveMail (HWND hWnd)
void DoMAPIAddress (HWND hWnd)
void SetFooter (LPSTR msg)
LPSTR GetMAPIError (LONG errorCode)
void ProcessMailCommand (HWND hWnd, int id, HWND hCtl, UINT codeNotify)
BOOL CALLBACK LOADDS MailDlgProc (HWND hWndMain, UINT wMsg, WPARAM wParam, LPARAM lParam)
void TackItOn (LPSTR fileBuf, LPSTR nameBuf, LPSTR addOn)
void FreeMAPIFile (lpMapiFileDesc pv)
void FreeMAPIRecipient (lpMapiRecipDesc pv)
void FreeMAPIMessage (lpMapiMessage pv)

Variables

HINSTANCE m_hInstMapi
LHANDLE mapiSession
static LPSTR lpszDelimChar = ";"

Function Documentation

void DoMAPIAddress ( HWND  hWnd)

Definition at line 648 of file mapimail.cpp.

{
  ULONG (FAR PASCAL *lpfnMAPIAddress) 
                            (LHANDLE lhSession,
                            ULONG ulUIParam,
                            LPSTR lpszCaption,
                            ULONG nEditFields,
                            LPSTR lpszLabels,
                            ULONG nRecips,
                            lpMapiRecipDesc lpRecips,
                            FLAGS flFlags,
                            ULONG ulReserved,
                            LPULONG lpnNewRecips,
                            lpMapiRecipDesc FAR *lppNewRecips);


#ifdef WIN16         
  (FARPROC&) lpfnMAPIAddress = GetProcAddress(m_hInstMapi, "MAPIADDRESS"); 
#else
  (FARPROC&) lpfnMAPIAddress = GetProcAddress(m_hInstMapi, "MAPIAddress"); 
#endif
  
  if (!lpfnMAPIAddress)
  {
    ShowMessage(hWnd, "Unable to locate MAPI function.");
    return;
  }          

  DWORD   i;
  FLAGS   flFlags = 0;
  DWORD   addrCount = 0;
  char    msg[512];
  char    toAddr[128];
  char    ccAddr[128];
  char    bccAddr[128];

  GetDlgItemText(hWnd, ID_EDIT_TOADDRESS, toAddr, sizeof(toAddr));
  GetDlgItemText(hWnd, ID_EDIT_CCADDRESS, ccAddr, sizeof(ccAddr));
  GetDlgItemText(hWnd, ID_EDIT_BCCADDRESS, bccAddr, sizeof(bccAddr));

  if (toAddr[0]) ++addrCount;
  if (ccAddr[0]) ++addrCount;
  if (bccAddr[0]) ++addrCount;

  lpMapiRecipDesc lpRecips = (lpMapiRecipDesc) malloc((size_t) (sizeof(MapiRecipDesc) * addrCount));
  if (!lpRecips)
  {
    return;
  }

  memset(lpRecips, 0, (size_t) (sizeof(MapiRecipDesc) * addrCount));

  DWORD       rCount = 0;
  if (toAddr[0] != '\0')
  {
    lpRecips[rCount].lpszName = strdup("To Address Name");
    lpRecips[rCount].lpszAddress = strdup(toAddr);
    lpRecips[rCount].ulRecipClass = MAPI_TO;
    rCount++;
  }

  if (ccAddr[0] != '\0')
  {
    lpRecips[rCount].lpszName = strdup("CC Address Name");
    lpRecips[rCount].lpszAddress = strdup(ccAddr);
    lpRecips[rCount].ulRecipClass = MAPI_CC;    
    rCount++;
  }

  if (bccAddr[0] != '\0')
  {
    lpRecips[rCount].lpszName = strdup("BCC Address Name");
    lpRecips[rCount].lpszAddress = strdup(bccAddr);
    lpRecips[rCount].ulRecipClass = MAPI_BCC;
    rCount++;
  }
  
  ULONG             newRecips;
  lpMapiRecipDesc   lpNewRecips;

  // Finally, make the call...
  LONG  rc = (*lpfnMAPIAddress)
                     (mapiSession,
                      0,
                      "MAPI Test Address Picker",
                      0,
                      NULL,
                      rCount,
                      lpRecips,
                      0,
                      0,
                      &newRecips,
                      &lpNewRecips);
  if (rc == SUCCESS_SUCCESS)
  {
    for (i=0; i<newRecips; i++)
    {
      char  tMsg[512];

      wsprintf(tMsg, "User %d\nName=[%s]\nEmail=[%s]\nType=[%d]", 
            i, 
            lpNewRecips[i].lpszName, 
            lpNewRecips[i].lpszAddress, 
            lpNewRecips[i].ulRecipClass);
      ShowMessage(hWnd, tMsg);
    }

    SetFooter("MAPIAddress success");

    DoMAPIFreeBuffer(hWnd, lpNewRecips, TRUE);
  }
  else
  {
    wsprintf(msg, "FAILURE: Return code %d from MAPIAddress\nError=[%s]", 
                      rc, GetMAPIError(rc));
    ShowMessage(hWnd, msg);
    SetFooter("MAPIAddress failed");
  }

  // Now cleanup and move on...
  for (i=0; i<rCount; i++)
  {
    FreeMAPIRecipient(&(lpRecips[i]));
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void DoMAPIFreeBuffer ( HWND  hWnd,
LPVOID  buf,
BOOL  alert 
)

Definition at line 360 of file mapiproc.cpp.

{
  ULONG (FAR PASCAL *lpfnMAPIFreeBuffer) (LPVOID lpBuffer);

#ifdef WIN16         
  (FARPROC&) lpfnMAPIFreeBuffer = GetProcAddress(m_hInstMapi, "MAPIFREEBUFFER"); 
#else
  (FARPROC&) lpfnMAPIFreeBuffer = GetProcAddress(m_hInstMapi, "MAPIFreeBuffer"); 
#endif
  
  if (!lpfnMAPIFreeBuffer)
  {
    ShowMessage(hWnd, "Unable to locate MAPI function.");
    return;
  }

  char  msg[1024];
  LONG  rc = (*lpfnMAPIFreeBuffer)(buf);
#ifdef WIN32
  if (rc == S_OK)
#else
  if (rc == SUCCESS_SUCCESS)
#endif
  {
    wsprintf(msg, "Successful Free Buffer Operation");
    if (alert)
      ShowMessage(hWnd, msg);
  }
  else
  {
    wsprintf(msg, "FAILURE: Return code %d from Logoff", rc);
    ShowMessage(hWnd, msg);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 463 of file mapimail.cpp.

{
  ULONG (FAR PASCAL *lpfnMAPISaveMail) (LHANDLE lhSession, ULONG ulUIParam, 
                  lpMapiMessage lpMessage, FLAGS flFlags, ULONG ulReserved,
                  LPTSTR lpszMessageID);

#ifdef WIN16         
  (FARPROC&) lpfnMAPISaveMail = GetProcAddress(m_hInstMapi, "MAPISAVEMAIL"); 
#else
  (FARPROC&) lpfnMAPISaveMail = GetProcAddress(m_hInstMapi, "MAPISaveMail"); 
#endif
  
  if (!lpfnMAPISaveMail)
  {
    ShowMessage(hWnd, "Unable to locate MAPI function.");
    return;
  }          

  FLAGS   flFlags = 0;
  char    msg[512];
  char    file1[_MAX_PATH] = "";
  char    file2[_MAX_PATH] = "";
  char    file3[_MAX_PATH] = "";
  char    file4[_MAX_PATH] = "";
  char    toAddr[128];
  char    ccAddr[128];
  char    bccAddr[128];
  char    subject[128];
  char    noteText[4096];
  char    dateReceived[128] = "N/A";
  char    threadID[128] = "N/A";
  char    origName[128] = "N/A";
  char    origAddress[128] = "N/A";

  GetDlgItemText(hWnd, ID_EDIT_TOADDRESS, toAddr, sizeof(toAddr));
  GetDlgItemText(hWnd, ID_EDIT_CCADDRESS, ccAddr, sizeof(ccAddr));
  GetDlgItemText(hWnd, ID_EDIT_BCCADDRESS, bccAddr, sizeof(bccAddr));
  GetDlgItemText(hWnd, ID_EDIT_SUBJECT, subject, sizeof(subject));
  GetDlgItemText(hWnd, ID_EDIT_NOTETEXT, noteText, sizeof(noteText));

  // Build the message to send off...
  lpMapiMessage  msgPtr = (MapiMessage *)malloc(sizeof(MapiMessage));
  if (msgPtr == NULL)
  {
    return;
  }
  
  memset(msgPtr, 0, sizeof(MapiMessage)); 

  //
  // At this point, we need to populate the structure of information
  // we are passing in via the *lppMessage
  //

  // Set all of the general information first!
  msgPtr->lpszSubject = strdup(subject);
  msgPtr->lpszNoteText = strdup(noteText);
  msgPtr->lpszDateReceived = strdup(dateReceived);
  msgPtr->lpszConversationID = strdup(threadID);
  msgPtr->flFlags = flFlags;

  // Now deal with the recipients of this message
  DWORD       realRecips = 0;
  if (toAddr[0] != '\0')    ++realRecips;
  if (ccAddr[0] != '\0')    ++realRecips;
  if (bccAddr[0] != '\0')   ++realRecips;

  msgPtr->lpRecips = (lpMapiRecipDesc) malloc((size_t) (sizeof(MapiRecipDesc) * realRecips));
  if (!msgPtr->lpRecips)
  {
    FreeMAPIMessage(msgPtr);
    return;
  }

  msgPtr->nRecipCount = realRecips;
  memset(msgPtr->lpRecips, 0, (size_t) (sizeof(MapiRecipDesc) * msgPtr->nRecipCount));

  DWORD       rCount = 0;
  if (toAddr[0] != '\0')
  {
    msgPtr->lpRecips[rCount].lpszName = strdup(toAddr);
    msgPtr->lpRecips[rCount].lpszAddress = strdup(toAddr);
    msgPtr->lpRecips[rCount].ulRecipClass = MAPI_TO;
    rCount++;
  }

  if (ccAddr[0] != '\0')
  {
    msgPtr->lpRecips[rCount].lpszName = strdup(ccAddr);
    msgPtr->lpRecips[rCount].lpszAddress = strdup(ccAddr);
    msgPtr->lpRecips[rCount].ulRecipClass = MAPI_CC;    
    rCount++;
  }

  if (bccAddr[0] != '\0')
  {
    msgPtr->lpRecips[rCount].lpszName = strdup(bccAddr);
    msgPtr->lpRecips[rCount].lpszAddress = strdup(bccAddr);
    msgPtr->lpRecips[rCount].ulRecipClass = MAPI_BCC;
    rCount++;
  }

  // Now get the names of the files to attach...
  GetDlgItemText(hWnd, ID_EDIT_ATTACH1, file1, sizeof(file1));
  GetDlgItemText(hWnd, ID_EDIT_ATTACH2, file2, sizeof(file2));
  GetDlgItemText(hWnd, ID_EDIT_ATTACH3, file3, sizeof(file3));
  GetDlgItemText(hWnd, ID_EDIT_ATTACH4, file4, sizeof(file4));

  DWORD       realFiles = 0;
  if (file1[0] != '\0')    ++realFiles;
  if (file2[0] != '\0')    ++realFiles;
  if (file3[0] != '\0')    ++realFiles;
  if (file4[0] != '\0')    ++realFiles;

  // Now deal with the list of attachments! Since the nFileCount should be set
  // correctly, this loop will automagically be correct
  //
  msgPtr->nFileCount = realFiles;
  if (realFiles > 0)
  {
    msgPtr->lpFiles = (lpMapiFileDesc) malloc((size_t) (sizeof(MapiFileDesc) * realFiles));
    if (!msgPtr->lpFiles)
    {
      FreeMAPIMessage(msgPtr);
      return;
    }

    memset(msgPtr->lpFiles, 0, (size_t) (sizeof(MapiFileDesc) * msgPtr->nFileCount));
  }

  rCount = 0;
  if (file1[0] != '\0')
  {
    msgPtr->lpFiles[rCount].lpszPathName = strdup((LPSTR)file1);
    msgPtr->lpFiles[rCount].lpszFileName = strdup((LPSTR)file1);
    ++rCount;
  }

  if (file2[0] != '\0')
  {
    msgPtr->lpFiles[rCount].lpszPathName = strdup((LPSTR)file2);
    msgPtr->lpFiles[rCount].lpszFileName = strdup((LPSTR)file2);
    ++rCount;
  }

  if (file3[0] != '\0')
  {
    msgPtr->lpFiles[rCount].lpszPathName = strdup((LPSTR)file3);
    msgPtr->lpFiles[rCount].lpszFileName = strdup((LPSTR)file3);
    ++rCount;
  }

  if (file4[0] != '\0')
  {
    msgPtr->lpFiles[rCount].lpszPathName = strdup((LPSTR)file4);
    msgPtr->lpFiles[rCount].lpszFileName = strdup((LPSTR)file4);
    ++rCount;
  }

  // Finally, make the call...
  LONG  rc = (*lpfnMAPISaveMail)
           (mapiSession, 
           (ULONG) hWnd, 
           msgPtr, 
           flFlags, 
           0, NULL);

  if (rc == SUCCESS_SUCCESS)
  {
    ShowMessage(hWnd, "Success with MAPISaveMail");
    SetFooter("MAPISaveMail success");
  }
  else
  {
    wsprintf(msg, "FAILURE: Return code %d from MAPISaveMail\nError=[%s]", 
                      rc, GetMAPIError(rc));
    ShowMessage(hWnd, msg);
    SetFooter("MAPISaveMail failed");
  }

  // Now cleanup and move on...
  FreeMAPIMessage(msgPtr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 130 of file mapimail.cpp.

{
  ULONG (FAR PASCAL *lpfnMAPISendDocuments) (ULONG ulUIParam, 
          LPTSTR lpszDelimChar, LPTSTR lpszFullPaths, 
          LPTSTR lpszFileNames, ULONG ulReserved);

#ifdef WIN16         
  (FARPROC&) lpfnMAPISendDocuments = GetProcAddress(m_hInstMapi, "MAPISENDDOCUMENTS"); 
#else
  (FARPROC&) lpfnMAPISendDocuments = GetProcAddress(m_hInstMapi, "MAPISendDocuments"); 
#endif
  
  if (!lpfnMAPISendDocuments)
  {
    ShowMessage(hWnd, "Unable to locate MAPI function.");
    return;
  }

  char  msg[1024];
  char  tempFileName[_MAX_PATH] = "";
  char  lpszFullPaths[(_MAX_PATH + 1) * 4] = "";
  char  lpszFileNames[(_MAX_PATH + 1) * 4] = "";

  // Now get the names of the files to attach...
  GetDlgItemText(hWnd, ID_EDIT_ATTACH1, tempFileName, sizeof(tempFileName));
  TackItOn(lpszFullPaths, lpszFileNames, tempFileName); 

  GetDlgItemText(hWnd, ID_EDIT_ATTACH2, tempFileName, sizeof(tempFileName));
  TackItOn(lpszFullPaths, lpszFileNames, tempFileName); 

  GetDlgItemText(hWnd, ID_EDIT_ATTACH3, tempFileName, sizeof(tempFileName));
  TackItOn(lpszFullPaths, lpszFileNames, tempFileName); 

  GetDlgItemText(hWnd, ID_EDIT_ATTACH4, tempFileName, sizeof(tempFileName));
  TackItOn(lpszFullPaths, lpszFileNames, tempFileName); 

  LONG  rc = (*lpfnMAPISendDocuments)
        ( (ULONG) hWnd,        
          lpszDelimChar, 
          lpszFullPaths, 
          lpszFileNames, 
          0);

  if (rc == SUCCESS_SUCCESS)
  {
    ShowMessage(hWnd, "Success with MAPISendDocuments");
    SetFooter("MAPISendDocuments success");
  }
  else
  {
    wsprintf(msg, "FAILURE: Return code %d from MAPISendDocuments\nError=[%s]", 
                      rc, GetMAPIError(rc));
    ShowMessage(hWnd, msg);
    SetFooter("MAPISendDocuments failed");
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 273 of file mapimail.cpp.

{
  ULONG (FAR PASCAL *lpfnMAPISendMail) (LHANDLE lhSession, ULONG ulUIParam, 
                  lpMapiMessage lpMessage, FLAGS flFlags, ULONG ulReserved);

#ifdef WIN16         
  (FARPROC&) lpfnMAPISendMail = GetProcAddress(m_hInstMapi, "MAPISENDMAIL"); 
#else
  (FARPROC&) lpfnMAPISendMail = GetProcAddress(m_hInstMapi, "MAPISendMail"); 
#endif
  
  if (!lpfnMAPISendMail)
  {
    ShowMessage(hWnd, "Unable to locate MAPI function.");
    return;
  }          

  FLAGS   flFlags = 0;
  char    msg[512];
  char    file1[_MAX_PATH] = "";
  char    file2[_MAX_PATH] = "";
  char    file3[_MAX_PATH] = "";
  char    file4[_MAX_PATH] = "";
  char    toAddr[128];
  char    ccAddr[128];
  char    bccAddr[128];
  char    subject[128];
  char    noteText[4096];
  char    dateReceived[128] = "N/A";
  char    threadID[128] = "N/A";
  char    origName[128] = "N/A";
  char    origAddress[128] = "N/A";

  GetDlgItemText(hWnd, ID_EDIT_TOADDRESS, toAddr, sizeof(toAddr));
  GetDlgItemText(hWnd, ID_EDIT_CCADDRESS, ccAddr, sizeof(ccAddr));
  GetDlgItemText(hWnd, ID_EDIT_BCCADDRESS, bccAddr, sizeof(bccAddr));
  GetDlgItemText(hWnd, ID_EDIT_SUBJECT, subject, sizeof(subject));
  GetDlgItemText(hWnd, ID_EDIT_NOTETEXT, noteText, sizeof(noteText));

  // Do the one flag we support for this call...
  if (BST_CHECKED == Button_GetCheck(GetDlgItem(hWnd, ID_CHECK_SHOWDIALOG)))
  {
    flFlags |= MAPI_DIALOG;
  }

  // Build the message to send off...
  lpMapiMessage  msgPtr = (MapiMessage *)malloc(sizeof(MapiMessage));
  if (msgPtr == NULL)
  {
    return;
  }
  
  memset(msgPtr, 0, sizeof(MapiMessage)); 

  //
  // At this point, we need to populate the structure of information
  // we are passing in via the *lppMessage
  //

  // Set all of the general information first!
  msgPtr->lpszSubject = strdup(subject);
  msgPtr->lpszNoteText = strdup(noteText);
  msgPtr->lpszDateReceived = strdup(dateReceived);
  msgPtr->lpszConversationID = strdup(threadID);
  msgPtr->flFlags = flFlags;

  // Now deal with the recipients of this message
  DWORD       realRecips = 0;
  if (toAddr[0] != '\0')    ++realRecips;
  if (ccAddr[0] != '\0')    ++realRecips;
  if (bccAddr[0] != '\0')   ++realRecips;

  msgPtr->lpRecips = (lpMapiRecipDesc) malloc((size_t) (sizeof(MapiRecipDesc) * realRecips));
  if (!msgPtr->lpRecips)
  {
    FreeMAPIMessage(msgPtr);
    return;
  }

  msgPtr->nRecipCount = realRecips;
  memset(msgPtr->lpRecips, 0, (size_t) (sizeof(MapiRecipDesc) * msgPtr->nRecipCount));

  DWORD       rCount = 0;
  if (toAddr[0] != '\0')
  {
    msgPtr->lpRecips[rCount].lpszName = strdup(toAddr);
    msgPtr->lpRecips[rCount].lpszAddress = strdup(toAddr);
    msgPtr->lpRecips[rCount].ulRecipClass = MAPI_TO;
    rCount++;
  }

  if (ccAddr[0] != '\0')
  {
    msgPtr->lpRecips[rCount].lpszName = strdup(ccAddr);
    msgPtr->lpRecips[rCount].lpszAddress = strdup(ccAddr);
    msgPtr->lpRecips[rCount].ulRecipClass = MAPI_CC;    
    rCount++;
  }

  if (bccAddr[0] != '\0')
  {
    msgPtr->lpRecips[rCount].lpszName = strdup(bccAddr);
    msgPtr->lpRecips[rCount].lpszAddress = strdup(bccAddr);
    msgPtr->lpRecips[rCount].ulRecipClass = MAPI_BCC;
    rCount++;
  }

  // Now get the names of the files to attach...
  GetDlgItemText(hWnd, ID_EDIT_ATTACH1, file1, sizeof(file1));
  GetDlgItemText(hWnd, ID_EDIT_ATTACH2, file2, sizeof(file2));
  GetDlgItemText(hWnd, ID_EDIT_ATTACH3, file3, sizeof(file3));
  GetDlgItemText(hWnd, ID_EDIT_ATTACH4, file4, sizeof(file4));

  DWORD       realFiles = 0;
  if (file1[0] != '\0')    ++realFiles;
  if (file2[0] != '\0')    ++realFiles;
  if (file3[0] != '\0')    ++realFiles;
  if (file4[0] != '\0')    ++realFiles;

  // Now deal with the list of attachments! Since the nFileCount should be set
  // correctly, this loop will automagically be correct
  //
  msgPtr->nFileCount = realFiles;
  if (realFiles > 0)
  {
    msgPtr->lpFiles = (lpMapiFileDesc) malloc((size_t) (sizeof(MapiFileDesc) * realFiles));
    if (!msgPtr->lpFiles)
    {
      FreeMAPIMessage(msgPtr);
      return;
    }

    memset(msgPtr->lpFiles, 0, (size_t) (sizeof(MapiFileDesc) * msgPtr->nFileCount));
  }

  rCount = 0;
  if (file1[0] != '\0')
  {
    msgPtr->lpFiles[rCount].lpszPathName = strdup((LPSTR)file1);
    msgPtr->lpFiles[rCount].lpszFileName = strdup((LPSTR)file1);
    ++rCount;
  }

  if (file2[0] != '\0')
  {
    msgPtr->lpFiles[rCount].lpszPathName = strdup((LPSTR)file2);
    msgPtr->lpFiles[rCount].lpszFileName = strdup((LPSTR)file2);
    ++rCount;
  }

  if (file3[0] != '\0')
  {
    msgPtr->lpFiles[rCount].lpszPathName = strdup((LPSTR)file3);
    msgPtr->lpFiles[rCount].lpszFileName = strdup((LPSTR)file3);
    ++rCount;
  }

  if (file4[0] != '\0')
  {
    msgPtr->lpFiles[rCount].lpszPathName = strdup((LPSTR)file4);
    msgPtr->lpFiles[rCount].lpszFileName = strdup((LPSTR)file4);
    ++rCount;
  }

  // Finally, make the call...
  LONG  rc = (*lpfnMAPISendMail)
           (mapiSession, 
           (ULONG) hWnd, 
           msgPtr, 
           flFlags, 
           0);

  if (rc == SUCCESS_SUCCESS)
  {
    ShowMessage(hWnd, "Success with MAPISendMail");
    SetFooter("MAPISendMail success");
  }
  else
  {
    wsprintf(msg, "FAILURE: Return code %d from MAPISendMail\nError=[%s]", 
                      rc, GetMAPIError(rc));
    ShowMessage(hWnd, msg);
    SetFooter("MAPISendMail failed");
  }

  // Now cleanup and move on...
  FreeMAPIMessage(msgPtr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FreeMAPIFile ( lpMapiFileDesc  pv)

Definition at line 188 of file mapimail.cpp.

{
  if (!pv)
    return;

  if (pv->lpszPathName != NULL)   
    free(pv->lpszPathName);

  if (pv->lpszFileName != NULL)   
    free(pv->lpszFileName);
}
void FreeMAPIMessage ( lpMapiMessage  pv)

Definition at line 217 of file mapimail.cpp.

{
  ULONG i;

  if (!pv)
    return;

  if (pv->lpszSubject != NULL)
    free(pv->lpszSubject);

  if (pv->lpszNoteText)
      free(pv->lpszNoteText);
  
  if (pv->lpszMessageType)
    free(pv->lpszMessageType);
  
  if (pv->lpszDateReceived)
    free(pv->lpszDateReceived);
  
  if (pv->lpszConversationID)
    free(pv->lpszConversationID);
  
  if (pv->lpOriginator)
    FreeMAPIRecipient(pv->lpOriginator);
  
  for (i=0; i<pv->nRecipCount; i++)
  {
    if (&(pv->lpRecips[i]) != NULL)
    {
      FreeMAPIRecipient(&(pv->lpRecips[i]));
    }
  }

  if (pv->lpRecips != NULL)
  {
    free(pv->lpRecips);
  }

  for (i=0; i<pv->nFileCount; i++)
  {
    if (&(pv->lpFiles[i]) != NULL)
    {
      FreeMAPIFile(&(pv->lpFiles[i]));
    }
  }

  if (pv->lpFiles != NULL)
  {
    free(pv->lpFiles);
  }
  
  free(pv);
  pv = NULL;
}

Here is the call graph for this function:

void FreeMAPIRecipient ( lpMapiRecipDesc  pv)

Definition at line 201 of file mapimail.cpp.

{
  if (!pv)
    return;

  if (pv->lpszName != NULL)   
    free(pv->lpszName);

  if (pv->lpszAddress != NULL)
    free(pv->lpszAddress);

  if (pv->lpEntryID != NULL)
    free(pv->lpEntryID);  
}
char FAR * GetMAPIError ( LONG  errorCode)

Definition at line 86 of file mapiproc.cpp.

{
  static char FAR msg[128];

  switch (errorCode) {                            
  case MAPI_E_FAILURE:
    lstrcpy(msg, "General MAPI Failure");
    break;

  case MAPI_E_INSUFFICIENT_MEMORY:
    strcpy(msg, "Insufficient Memory");
    break;

  case MAPI_E_LOGIN_FAILURE:
    strcpy(msg, "Login Failure");
    break;

  case MAPI_E_TOO_MANY_SESSIONS:
    strcpy(msg, "Too many MAPI sessions");
    break;

  case MAPI_E_INVALID_SESSION:
    strcpy(msg, "Invalid Session!");
    break;

  case MAPI_E_INVALID_MESSAGE:
    strcpy(msg, "Message identifier was bad!");
    break;

  case MAPI_E_NO_MESSAGES:
    strcpy(msg, "No messages were found!");
    break;

  case MAPI_E_ATTACHMENT_WRITE_FAILURE:
    strcpy(msg, "Attachment write failure!");
    break;

  case MAPI_E_DISK_FULL:
    strcpy(msg, "Attachment write failure! DISK FULL");
    break;

  case MAPI_E_AMBIGUOUS_RECIPIENT:
    strcpy(msg, "Recipient requested is not a unique address list entry.");
    break;

  case MAPI_E_UNKNOWN_RECIPIENT:
    strcpy(msg, "Recipient requested does not exist.");
    break;

  case MAPI_E_NOT_SUPPORTED:
    strcpy(msg, "Not supported by messaging system");
    break;

  case SUCCESS_SUCCESS:
    strcpy(msg, "Success on MAPI operation");
    break;

  case MAPI_E_INVALID_RECIPS:
    strcpy(msg, "Recipient specified in the lpRecip parameter was\nunknown. No dialog box was displayed.");
    break;

  case MAPI_E_ATTACHMENT_OPEN_FAILURE:
    strcpy(msg, "One or more files could not be located. No message was sent.");    
    break;

  case MAPI_E_ATTACHMENT_NOT_FOUND:
    strcpy(msg, "The specified attachment was not found. No message was sent.");
    break;

  case MAPI_E_BAD_RECIPTYPE:
    strcpy(msg, "The type of a recipient was not MAPI_TO, MAPI_CC, or MAPI_BCC. No message was sent.");
    break;

  default:
    strcpy(msg, "Unknown MAPI Return Code");
    break;
  }

  return((LPSTR) &(msg[0]));
}

Here is the caller graph for this function:

BOOL CALLBACK LOADDS MailDlgProc ( HWND  hWndMain,
UINT  wMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 96 of file mapimail.cpp.

{
  switch (wMsg) 
  {
  case WM_INITDIALOG: 
    break;

  case WM_COMMAND:
    HANDLE_WM_COMMAND(hWndMain, wParam, lParam, ProcessMailCommand);
    break;

  default:
    return FALSE;
  }
  
  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ProcessMailCommand ( HWND  hWnd,
int  id,
HWND  hCtl,
UINT  codeNotify 
)

Definition at line 66 of file mapimail.cpp.

{ 
  switch (id) 
  {
  case IDCANCEL:
    EndDialog(hWnd, 0);
    break;

  case ID_BUTTON_MAPISENDMAIL:
    DoMAPISendMail(hWnd);
    break;

  case ID_BUTTON_MAPISENDDOCUMENTS:
    DoMAPISendDocuments(hWnd);
    break;

  case ID_BUTTON_MAPISAVEMAIL:
    DoMAPISaveMail(hWnd);
    break;

  case ID_BUTTON_MAPIADDRESS:
    DoMAPIAddress(hWnd);
    break;

  default:
    break;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SetFooter ( LPSTR  msg)

Definition at line 78 of file mapiproc.cpp.

{
  extern HWND   hWnd;

  SetDlgItemText(hWnd, ID_STATIC_RESULT, msg);
}

Here is the caller graph for this function:

void ShowMessage ( HWND  hWnd,
LPSTR  msg 
)

Definition at line 168 of file mapiproc.cpp.

{
  MessageBox(hWnd, msg, "Info Message", MB_ICONINFORMATION);
}
void TackItOn ( LPSTR  fileBuf,
LPSTR  nameBuf,
LPSTR  addOn 
)

Definition at line 117 of file mapimail.cpp.

{
  if (addOn[0] != '\0')
  {
    lstrcat(fileBuf, addOn);
    lstrcat(fileBuf, lpszDelimChar);

    lstrcat(nameBuf, "NAMEOF.FILE");
    lstrcat(nameBuf, lpszDelimChar);
  }
}

Here is the caller graph for this function:


Variable Documentation

LPSTR lpszDelimChar = ";" [static]

Definition at line 114 of file mapimail.cpp.

Definition at line 53 of file mapiproc.cpp.

LHANDLE mapiSession

Definition at line 54 of file mapiproc.cpp.