Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. MAPI: MapiRecipDesc is not properly working with Lotus Notes (ver8.5) [modified]

MAPI: MapiRecipDesc is not properly working with Lotus Notes (ver8.5) [modified]

Scheduled Pinned Locked Moved ATL / WTL / STL
helpc++delphicomdebugging
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vinvino2001
    wrote on last edited by
    #1

    Hi, I need to send a mail to a particular email address from the application. For this purpose, I am using MAPI APIs. Following is the code which is used in the application. This code is working properly with MS Outlook Express; however, in Lotus Notes, email ID specified in the code is not added to the "To" field of email. Other values given in the MapiRecipDesc structure is added to the email properly. Can any one help to solve the issue?

    // Mail Application.cpp : Defines the entry point for the console application.
    //

    #include "stdafx.h"
    #include "Mail Application.h"
    #include <MAPI.h>

    #ifdef _DEBUG
    #define new DEBUG_NEW
    #endif

    // The one and only application object

    CWinApp theApp;

    using namespace std;

    int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
    {
    int nRetCode = 0;

    // initialize MFC and print and error on failure
    if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
    {
    	// TODO: change error code to suit your needs
    	\_tprintf(\_T("Fatal Error: MFC initialization failed\\n"));
    	nRetCode = 1;
    }
    else
    {
    	MapiRecipDesc sender;
    	MapiRecipDesc recipient;
    	MapiMessage note;
    	HMODULE hinstMapi32Dll = NULL;
    
    	if (hinstMapi32Dll == NULL)
    		hinstMapi32Dll = ::LoadLibraryA("MAPI32.DLL");
    
    	if (hinstMapi32Dll == NULL)
    	{
    		AfxMessageBox(AFX\_IDP\_FAILED\_MAPI\_LOAD);
    		return -1;
    	}
    	ULONG (PASCAL \*lpfnMAPISendMail)(ULONG, ULONG, MapiMessage\*, FLAGS, ULONG);
    	lpfnMAPISendMail = (LPMAPISENDMAIL)GetProcAddress( hinstMapi32Dll, "MAPISendMail");
    
    	sender.ulReserved = 0;
    	sender.ulRecipClass = MAPI\_ORIG;
    	sender.lpszName = "My Name";
    	sender.lpszAddress = "me@myeamil.com";
    	sender.ulEIDSize = 0;
    	sender.lpEntryID = NULL;
    
    	recipient.ulReserved = 0;
    	recipient.ulRecipClass = MAPI\_TO;
    	recipient.lpszName = "Person Name";
    	recipient.lpszAddress = "SMTP:towhomitmayconcern@email.com";
    	recipient.ulEIDSize = 0;
    	recipient.lpEntryID = NULL;
    
    	note.ulReserved = 0;
    	note.lpszSubject = "Subject goes here";
    	note.lpszNoteText = "Message body goes here";
    	note.lpszMessageType = NULL;
    	note.lpszDateReceived = NULL;
    	note.lpszConversationID = NULL;
    	note.flFlags = 0L;
    	note.lpOriginator = &sender;
    	note.nRecipCount = 1;
    	note.lpRecips = &recipient;
    	note.nFileCount = 0;
    	note.lpFiles = NULL;
    
    	nRetCode = lpfnMAPISendMail( 0, 0L, &note, MAPI\_DIALOG, 0L );
    
    }
    
    return nRetCode;
    

    }

    Regards, Vinoth

    modified on

    V 1 Reply Last reply
    0
    • V vinvino2001

      Hi, I need to send a mail to a particular email address from the application. For this purpose, I am using MAPI APIs. Following is the code which is used in the application. This code is working properly with MS Outlook Express; however, in Lotus Notes, email ID specified in the code is not added to the "To" field of email. Other values given in the MapiRecipDesc structure is added to the email properly. Can any one help to solve the issue?

      // Mail Application.cpp : Defines the entry point for the console application.
      //

      #include "stdafx.h"
      #include "Mail Application.h"
      #include <MAPI.h>

      #ifdef _DEBUG
      #define new DEBUG_NEW
      #endif

      // The one and only application object

      CWinApp theApp;

      using namespace std;

      int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
      {
      int nRetCode = 0;

      // initialize MFC and print and error on failure
      if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
      {
      	// TODO: change error code to suit your needs
      	\_tprintf(\_T("Fatal Error: MFC initialization failed\\n"));
      	nRetCode = 1;
      }
      else
      {
      	MapiRecipDesc sender;
      	MapiRecipDesc recipient;
      	MapiMessage note;
      	HMODULE hinstMapi32Dll = NULL;
      
      	if (hinstMapi32Dll == NULL)
      		hinstMapi32Dll = ::LoadLibraryA("MAPI32.DLL");
      
      	if (hinstMapi32Dll == NULL)
      	{
      		AfxMessageBox(AFX\_IDP\_FAILED\_MAPI\_LOAD);
      		return -1;
      	}
      	ULONG (PASCAL \*lpfnMAPISendMail)(ULONG, ULONG, MapiMessage\*, FLAGS, ULONG);
      	lpfnMAPISendMail = (LPMAPISENDMAIL)GetProcAddress( hinstMapi32Dll, "MAPISendMail");
      
      	sender.ulReserved = 0;
      	sender.ulRecipClass = MAPI\_ORIG;
      	sender.lpszName = "My Name";
      	sender.lpszAddress = "me@myeamil.com";
      	sender.ulEIDSize = 0;
      	sender.lpEntryID = NULL;
      
      	recipient.ulReserved = 0;
      	recipient.ulRecipClass = MAPI\_TO;
      	recipient.lpszName = "Person Name";
      	recipient.lpszAddress = "SMTP:towhomitmayconcern@email.com";
      	recipient.ulEIDSize = 0;
      	recipient.lpEntryID = NULL;
      
      	note.ulReserved = 0;
      	note.lpszSubject = "Subject goes here";
      	note.lpszNoteText = "Message body goes here";
      	note.lpszMessageType = NULL;
      	note.lpszDateReceived = NULL;
      	note.lpszConversationID = NULL;
      	note.flFlags = 0L;
      	note.lpOriginator = &sender;
      	note.nRecipCount = 1;
      	note.lpRecips = &recipient;
      	note.nFileCount = 0;
      	note.lpFiles = NULL;
      
      	nRetCode = lpfnMAPISendMail( 0, 0L, &note, MAPI\_DIALOG, 0L );
      
      }
      
      return nRetCode;
      

      }

      Regards, Vinoth

      modified on

      V Offline
      V Offline
      vinvino2001
      wrote on last edited by
      #2

      Can any one help on this? Regards, Vinoth

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups