MAPI: MapiRecipDesc is not properly working with Lotus Notes (ver8.5) [modified]
-
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, ¬e, MAPI\_DIALOG, 0L ); } return nRetCode;
}
Regards, Vinoth
modified on
-
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, ¬e, MAPI\_DIALOG, 0L ); } return nRetCode;
}
Regards, Vinoth
modified on
Can any one help on this? Regards, Vinoth