Click here to Skip to main content
15,887,464 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: write a C program to find the area and perimeter of a circle? Pin
Stephen Hewitt4-Mar-11 17:03
Stephen Hewitt4-Mar-11 17:03 
Questionfreeing pointers in pointer array causes SegFault [solved] Pin
Jordanwb27-Feb-11 9:03
Jordanwb27-Feb-11 9:03 
AnswerRe: freeing pointers in pointer array causes SegFault Pin
Cool_Dev27-Feb-11 19:06
Cool_Dev27-Feb-11 19:06 
AnswerRe: freeing pointers in pointer array causes SegFault Pin
Richard MacCutchan27-Feb-11 23:01
mveRichard MacCutchan27-Feb-11 23:01 
GeneralRe: freeing pointers in pointer array causes SegFault Pin
Jordanwb28-Feb-11 4:18
Jordanwb28-Feb-11 4:18 
GeneralRe: freeing pointers in pointer array causes SegFault Pin
Richard MacCutchan28-Feb-11 6:10
mveRichard MacCutchan28-Feb-11 6:10 
GeneralRe: freeing pointers in pointer array causes SegFault Pin
Jordanwb28-Feb-11 6:57
Jordanwb28-Feb-11 6:57 
QuestionMAPI: MapiRecipDesc is not properly working with Lotus Notes (ver8.5) [modified] Pin
vinvino200122-Feb-11 2:55
vinvino200122-Feb-11 2:55 
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 Wednesday, February 23, 2011 12:01 AM

AnswerRe: MAPI: MapiRecipDesc is not properly working with Lotus Notes (ver8.5) Pin
vinvino200123-Feb-11 20:17
vinvino200123-Feb-11 20:17 
QuestionFunction pointer syntax help Pin
Xpnctoc19-Feb-11 17:38
Xpnctoc19-Feb-11 17:38 
AnswerRe: Function pointer syntax help Pin
Alain Rist19-Feb-11 20:19
Alain Rist19-Feb-11 20:19 
GeneralRe: Function pointer syntax help Pin
Xpnctoc20-Feb-11 10:15
Xpnctoc20-Feb-11 10:15 
AnswerRe: Function pointer syntax help Pin
Yusuf20-Feb-11 1:45
Yusuf20-Feb-11 1:45 
AnswerSOLVED: Re: Function pointer syntax help Pin
Xpnctoc20-Feb-11 10:29
Xpnctoc20-Feb-11 10:29 
GeneralRe: SOLVED: Re: Function pointer syntax help Pin
Albert Holguin20-Feb-11 11:26
professionalAlbert Holguin20-Feb-11 11:26 
GeneralRe: SOLVED: Re: Function pointer syntax help Pin
Xpnctoc20-Feb-11 12:36
Xpnctoc20-Feb-11 12:36 
GeneralRe: SOLVED: Re: Function pointer syntax help Pin
Michael Dunn20-Feb-11 21:43
sitebuilderMichael Dunn20-Feb-11 21:43 
GeneralRe: SOLVED: Re: Function pointer syntax help Pin
Xpnctoc21-Feb-11 4:15
Xpnctoc21-Feb-11 4:15 
GeneralRe: SOLVED: Re: Function pointer syntax help Pin
Albert Holguin21-Feb-11 10:51
professionalAlbert Holguin21-Feb-11 10:51 
GeneralRe: SOLVED: Re: Function pointer syntax help Pin
Xpnctoc21-Feb-11 10:56
Xpnctoc21-Feb-11 10:56 
GeneralRe: SOLVED: Re: Function pointer syntax help Pin
Albert Holguin21-Feb-11 10:56
professionalAlbert Holguin21-Feb-11 10:56 
GeneralRe: SOLVED: Re: Function pointer syntax help Pin
Xpnctoc21-Feb-11 10:59
Xpnctoc21-Feb-11 10:59 
GeneralRe: SOLVED: Re: Function pointer syntax help Pin
Albert Holguin21-Feb-11 15:18
professionalAlbert Holguin21-Feb-11 15:18 
QuestionANSI C in VS 2010 Pin
Xpnctoc16-Feb-11 3:50
Xpnctoc16-Feb-11 3:50 
AnswerRe: ANSI C in VS 2010 Pin
Xpnctoc16-Feb-11 4:02
Xpnctoc16-Feb-11 4:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.