|
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
|
|
|
|
|
Have you tried scaling the code down to something a wee bit smaller? What does the following produce:
HINSTANCE hMAPIInstance = LoadLibrary("MAPI32.DLL");
LPMAPILOGON lpMAPILogon = (LPMAPILOGON) GetProcAddress(hMAPIInstance, "MAPILogon");
LPMAPIRESOLVENAME lpMAPIResolveName = (LPMAPIRESOLVENAME) GetProcAddress(hMAPIInstance, "MAPIResolveName");
LPMAPISENDMAIL lpMAPISendMail = (LPMAPISENDMAIL) GetProcAddress(hMAPIInstance, "MAPISendMail");
LHANDLE lSession;
UINT uResult = (*lpMAPILogon)((UINT) m_hWnd, NULL, NULL, 0, 0, &lSession);
MapiRecipDesc *prMapiRecipient;
uResult = (*lpMAPIResolveName)(lSession, (UINT) m_hWnd, (LPSTR) lpszRecipient, 0, 0, prMapiRecipient);
lpMapiRecipDesc->ulReserved = 0;
lpMapiRecipDesc->ulRecipClass = MAPI_TO;
MapiMessage MapiMsg = {0};
MapiMsg.lpszSubject = (LPSTR) lpszSubject;
MapiMsg.lpszNoteText = (LPSTR) lpszBody;
MapiMsg.nRecipCount = 1;
MapiMsg.lpRecips = prMapiRecipient;
uResult = (*lpMAPISendMail)(lSession, (UINT) m_hWnd, &MapiMsg, 0, 0);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
hey I scaled it down as much as I could
and it doesn't matter what that returns as long as mapi logon didn't work no?
|
|
|
|
|
me also but I didn`t log in wrote:
hey I scaled it down as much as I could
I've seen worse!
me also but I didn`t log in wrote:
and it doesn't matter what that returns as long as mapi logon didn't work no?
What is the "that" which you are referring to?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I've been searching this topic for quite a while on
the codeproject, however, I can only find the similar
project using .Net in C# or VB.
I'm planning on writing an MP3 ripper, which can read
from CD ,then translate to MP3 format. But the key is,
I'm planning on Win 32 API, not .Net!! And it will be
written in C++.
If you do know a similar project elsewhere, or maybe
even on codeproject, please let me know. However, I
don't think there is one has been written, so you any
one of you who are looking for a topic to write, will you
please consider it?
Thanks.
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
See these links:
Both of these rock but BASS is newer.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thanks for your reply. However, the link for
the BASS does not work, would you fix it?
Thanks again.
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
|
Thanks.
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
I've filled my list box with alot of file path names, a they ALL are wider than the list box, but the horz scroll bar is still disabled. Why is it disabled, and how to I enable it?
wWw.KruncherInc.cOm - My cool programs
|
|
|
|
|
|
As Joe does not update his CP articles, and the pgh.net URL has not been active in quite some time, I thought I'd provide you with this:
http://flounder.com/hscroll.htm
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I am trying to use GDI+ for the first time and am trying to access each row and column of a jpeg image of 298 X 448 dimension. Is there any function for it or any way to do that?
|
|
|
|
|
Is there a way to show tooltips even on disabled buttons?
|
|
|
|
|
i had a a question like this one i the past but I didn't get the answer I wanted;
I want to know how can I hook a windows function for example
int connect(
SOCKET s,
const struct sockaddr FAR *name,
int namelen
);
and replace it with a function of mine or something like this until I let the program call it like in a firewall.
please help me.
gabby
|
|
|
|
|
There are a few articles here on CodeProject dealing with API hooking.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
i have a project which being planed to pretent API HOOK by other programs.
for instance. I want to use the WINAPI OpenProcess function. But it is easily to Hook by other program by GetModulHandle("Kernel32.dll")...........
so i changed the file name of the "Kernel32.dll" to "myprocess.dll" and put it in my project and i want to use the OpenProcess function in "myprocess.dll" but not in the "Kernel32.dll" anymore
anyone who knows how to do it?
many thanks
|
|
|
|
|
Extreme programming?? What's that? I increasingly hear
people talking about it, but I have no idea what's that
about. If you know, would you share it?
Thanks
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
|
Hmm, my original post didn't post.
XP is a collection of some old and new programming practices repackaged into something that the creators claim to be their own. (Unit testing? Um, been around for years.)
XP is mostly hype and doesn't apply very well to medium to large teams. The flagship project which was to create a payroll system for a car company failed after it ran way over budget, was four years behind and failed to even general payroll for a third of the company.
They claim this to be a success. This is how much hype is behind XP.
Some people will say that "Hey, I use 'X' and that is part of XP so XP can't be that bad". The problem is that XP, as dictated by the creators, is either all or nothing. You can't pick a choose elements of XP and claim you are doing XP. This just adds to the silliness of XP.
Many of the elements of XP are in fact very good. But as a whole, XP is basically a formula for disaster.
HYPE HYPE HYPE and more HYPE.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim Smith wrote:
You can't pick a choose elements of XP and claim you are doing XP
But you can pick and choose elements of XP to greatly improve the development process
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
Extreme programming: Hacking or taking a general outline and using it to produce a program (this is what they used to call real-programming).
Extreme programming is a formalisation of hacking. In other words it is hacking with rules.
Hacking: Take an idea, may be draw up some diagrams (to cristalise the idea), then start typing (to bring the idea into being). Sort of like writting a book.
Extreme programming means that you do not spend mass amounts of time figuring out every detail ahead of time (these will change anyway). What you do give is what goes in and what should comesout, the rest is up to the individual(s) writing that module.
Extream programming is best done in teams of two so they can draw off each others experience and avoid burning themselfs out.
Extream programming is what newer programmers (passed 10 years or so) have been making jokes about (real-programming), the only difference is that now they have attempted to formilise it.
INTP
|
|
|
|
|
any one help me how to load TIFF image into my
MFC application?
how get information of pixel in that TIFF image?
if any one find solution please share with me.
|
|
|
|
|
Try the graphics library CxImage, available on CP. http://www.codeproject.com/bitmap/cximage.asp
or www.libtiff.org and get the tifflib library, CxImage uses this library as well
"Home computers are being called upon to perform many new functions, including the consumption of homework formerly eaten by the dog." - Doug Larson
|
|
|
|
|
I would like to ask you what is the best best way to store information like, for instance, user preferences, on a CFormView project.
Serializing would make it but i do not know how to make avoiding the Open/Save dialog.
It woul be nice if you could help me.
Thanks in advance
|
|
|
|
|