Click here to Skip to main content
15,902,635 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How 2 communicate with other objects. Pin
Anonymous8-Aug-04 10:44
Anonymous8-Aug-04 10:44 
GeneralCEditView re-sets caret position on save Pin
sschilachi8-Aug-04 0:29
sschilachi8-Aug-04 0:29 
Generalloading resource only dlls Pin
Ted Podelnyk7-Aug-04 20:28
Ted Podelnyk7-Aug-04 20:28 
GeneralRe: loading resource only dlls Pin
bikram singh7-Aug-04 22:09
bikram singh7-Aug-04 22:09 
GeneralRe: loading resource only dlls Pin
Michael Dunn8-Aug-04 7:12
sitebuilderMichael Dunn8-Aug-04 7:12 
QuestionAny way to programmatically select a printer? Pin
DanYELL7-Aug-04 15:08
DanYELL7-Aug-04 15:08 
AnswerRe: Any way to programmatically select a printer? Pin
7-Aug-04 18:59
suss7-Aug-04 18:59 
GeneralMapi doesn't work Pin
Spiritofamerica7-Aug-04 11:16
Spiritofamerica7-Aug-04 11:16 
Hello

I have a question

I am trying to send mail with mapi

I have configured my outlook express and I have an account called TestProfile there.

So I load up mapi like this:

<br />
<br />
LHANDLE session;<br />
MapiMessage *mes;<br />
MapiRecipDesc from;<br />
char messId[512],mname[50],maddr[30],fsubj[50];<br />
HINSTANCE hMAPI;<br />
<br />
<br />
ULONG (PASCAL FAR *mSendMail)(ULONG, ULONG, MapiMessage*, FLAGS, ULONG);<br />
ULONG (PASCAL FAR *mLogoff)(LHANDLE, ULONG, FLAGS, ULONG);<br />
ULONG (PASCAL FAR *mLogon)(ULONG, LPTSTR, LPTSTR, FLAGS, ULONG, LPLHANDLE);<br />
ULONG (PASCAL FAR *mFindNext)(LHANDLE, ULONG, LPTSTR, LPTSTR, FLAGS, ULONG, LPTSTR);<br />
ULONG (PASCAL FAR *mReadMail)(LHANDLE, ULONG, LPTSTR, FLAGS, ULONG, lpMapiMessage FAR *);<br />
ULONG (PASCAL FAR *mFreeBuffer)(LPVOID);<br />
<br />
<br />
		hMAPI=LoadLibrary("MAPI32.DLL");<br />
		if (hMAPI==NULL)<br />
		{<br />
			MessageBox(0,"nu exista MAPI.DLL ","ciudat",MB_OK);<br />
		}<br />
		(FARPROC &)mSendMail=GetProcAddress(hMAPI, "MAPISendMail");<br />
		<br />
		MessageBox(0,"am ajuns aici","a",MB_OK);<br />
		<br />
		(FARPROC &)mLogon=GetProcAddress(hMAPI, "MAPILogon");<br />
		(FARPROC &)mLogoff=GetProcAddress(hMAPI, "MAPILogoff");<br />
		(FARPROC &)mFindNext=GetProcAddress(hMAPI, "MAPIFindNext");<br />
		(FARPROC &)mReadMail=GetProcAddress(hMAPI, "MAPIReadMail");<br />
		(FARPROC &)mFreeBuffer=GetProcAddress(hMAPI, "MAPIFreeBuffer");<br />
		<br />
<br />
		if (mLogon==NULL)<br />
		{<br />
			MessageBox(0,"nu exista functia mlogon ","ciudat",MB_OK);<br />
		}<br />
<br />


then I logon to mapi because I understand that you can't send mail if you don't correct me if I am wrong

<br />
<br />
ULONG a;<br />
<br />
			a=mLogon(NULL,NULL,NULL,MAPI_NEW_SESSION ,NULL,&session);<br />
			switch(a)<br />
			{<br />
				case MAPI_E_FAILURE:<br />
<br />
					MessageBox(0,"One or more unspecified errors occurred during logon. No session handle was returned.","a",MB_OK); <br />
				break;<br />
				case MAPI_E_INSUFFICIENT_MEMORY: <br />
					MessageBox(0,"There was insufficient memory to proceed. No session handle was returned. ","a",MB_OK);<br />
				break;<br />
				case MAPI_E_LOGIN_FAILURE:<br />
					MessageBox(0,"There was no default logon, and the user failed to log on successfully when the logon dialog box was displayed. No session handle was returned. ","a",MB_OK);<br />
				break;<br />
<br />
				case MAPI_E_TOO_MANY_SESSIONS:<br />
					MessageBox(0,"The user had too many sessions open simultaneously. No session handle was returned. ","a",MB_OK);<br />
				break;<br />
				case MAPI_E_USER_ABORT:<br />
					<br />
					MessageBox(0,"The user canceled the logon dialog box. No session handle was returned. ","a",MB_OK);<br />
				break;<br />
				case SUCCESS_SUCCESS:<br />
					MessageBox(0,"a mers?!?","ciudat",MB_OK);<br />
				break;<br />
<br />
				default:<br />
				{<br />
					MessageBox(0,"m-am dat reaku ","ciudat",MB_OK);<br />
				}<br />
<br />
			}<br />
<br />


now here is the problem I always end up in the default wich means it is none of the above
This started after I made that outlook account TestProfile

I made it because I read a article on codeproject.com about mapi and it said that I should have one like that and I made one but I still can't send mail not even with the program from that article(compiled source code)

Before I did this MAPI used to log on but I never got to send any mail
It always prompted me if I wanted my mail to be send and I always said yes but I never got to send any mail.


Maby I did something wrong I don't know here is how tryed to send it:

<br />
<br />
mes->ulReserved=0;<br />
					mes->lpszSubject=fsubj;<br />
					mes->lpszNoteText="bla bla bal";<br />
					mes->lpszMessageType=NULL;<br />
					mes->lpszDateReceived=NULL;<br />
					mes->lpszConversationID=NULL;<br />
					mes->flFlags=MAPI_SENT;<br />
					mes->lpOriginator->ulReserved=0;<br />
					mes->lpOriginator->ulRecipClass=MAPI_ORIG;<br />
					mes->lpOriginator->lpszName=mes->lpRecips->lpszName;<br />
					mes->lpOriginator->lpszAddress=mes->lpRecips->lpszAddress;<br />
					mes->nRecipCount=1;<br />
					mes->lpRecips->ulReserved=0;<br />
					mes->lpRecips->ulRecipClass=MAPI_TO;<br />
					mes->lpRecips->lpszName=mname;<br />
					mes->lpRecips->lpszAddress=maddr;<br />
					mes->nFileCount=1;<br />
					mes->lpFiles=(MapiFileDesc *)malloc(sizeof(MapiFileDesc));<br />
					memset(mes->lpFiles, 0, sizeof(MapiFileDesc));<br />
					mes->lpFiles->ulReserved=0;<br />
					mes->lpFiles->flFlags=NULL;<br />
					mes->lpFiles->nPosition=-1;<br />
					mes->lpFiles->lpszPathName="D:\a.txt";<br />
					mes->lpFiles->lpszFileName="a.txt";<br />
					mes->lpFiles->lpFileType=NULL;<br />
					mSendMail(session, NULL, mes, NULL, NULL);<br />
<br />


I am running win xp

please help out

thank you for your time

oh, and here is the name of that app I took from codeproject and it did not work for me to send mail with it :

Sending Email using MAPI - A COM DLL
By Aisha Ikram
GeneralRe: Mapi doesn't work Pin
David Crow9-Aug-04 3:49
David Crow9-Aug-04 3:49 
GeneralRe: Mapi doesn't work Pin
me also but I didn't log in9-Aug-04 9:24
sussme also but I didn't log in9-Aug-04 9:24 
GeneralRe: Mapi doesn't work Pin
David Crow9-Aug-04 10:58
David Crow9-Aug-04 10:58 
GeneralNEED HELP -- Win 32 MP3 ripper project Pin
Link26007-Aug-04 10:57
Link26007-Aug-04 10:57 
GeneralRe: NEED HELP -- Win 32 MP3 ripper project Pin
Ravi Bhavnani7-Aug-04 13:16
professionalRavi Bhavnani7-Aug-04 13:16 
GeneralRe: NEED HELP -- Win 32 MP3 ripper project Pin
Link26007-Aug-04 13:20
Link26007-Aug-04 13:20 
GeneralRe: NEED HELP -- Win 32 MP3 ripper project Pin
Ravi Bhavnani7-Aug-04 13:21
professionalRavi Bhavnani7-Aug-04 13:21 
GeneralRe: NEED HELP -- Win 32 MP3 ripper project Pin
Link26007-Aug-04 13:22
Link26007-Aug-04 13:22 
GeneralList Box Pin
Timothy Grabrian7-Aug-04 9:13
professionalTimothy Grabrian7-Aug-04 9:13 
GeneralRe: List Box Pin
Ravi Bhavnani7-Aug-04 9:35
professionalRavi Bhavnani7-Aug-04 9:35 
GeneralRe: List Box Pin
David Crow9-Aug-04 3:55
David Crow9-Aug-04 3:55 
GeneralManipulating rows and columns of an Image!! Pin
SR777-Aug-04 7:29
SR777-Aug-04 7:29 
GeneralTooltip in disabled buttons Pin
Rico Zuñiga7-Aug-04 7:07
Rico Zuñiga7-Aug-04 7:07 
Generalhoking functions Pin
gamitech7-Aug-04 5:59
gamitech7-Aug-04 5:59 
GeneralRe: hoking functions Pin
Ryan Binns8-Aug-04 18:31
Ryan Binns8-Aug-04 18:31 
GeneralNeed Help Pin
single647-Aug-04 5:10
single647-Aug-04 5:10 
QuestionExtreme programming?? What's that? Pin
Link26007-Aug-04 4:48
Link26007-Aug-04 4:48 

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.