BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Strange problems with MAPI

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
Mike Collins
Guest





PostPosted: Tue Aug 09, 2005 6:00 pm    Post subject: Strange problems with MAPI Reply with quote



Hi all got a very strange problem with MAPI. I've created a basic wrapper
for MAPI which looks like this:

int TSystemTools::SendEmail(TMapiMessage *MapiMessage)
{
int iRtn = -1;
Cardinal mError;
try
{
mError = MapiSendMail(0, reinterpret_cast<unsigned
int>(Application->Handle),
*MapiMessage,
MAPI_DIALOG|MAPI_LOGON_UI|MAPI_NEW_SESSION, 0);
}
catch(...)
{
}
iRtn = (unsigned __int32)mError;
return iRtn;
}

Not impressive there. Now I call this code in the process of the user
registering / licencing an application from the LicenceDlg. In one
application the code executes no problems, in the orther it doesn't the code
is exactly the same in other (I've cut&pasted to check). It simply returns
MAPI_E_FAILURE which doesn't really help be debug the problem. Calling code
looks like this:


AnsiString szBodyText = "Some registration informtion......"
TMapiMessage MapiMessage;
Cardinal mError;
TMapiRecipDesc MapiRecipients[1];
MapiRecipients[0].ulReserved = 0;
MapiRecipients[0].ulRecipClass = MAPI_TO;
MapiRecipients[0].lpszName = "Sales";
MapiRecipients[0].lpszAddress = [email]sales (AT) softwareassociates (DOT) nu[/email];
MapiRecipients[0].ulEIDSize = 0;
MapiRecipients[0].lpEntryID = NULL;

MapiMessage.ulReserved = 0;
MapiMessage.lpszSubject = "Registration request...";
MapiMessage.lpszNoteText = szBodyText.c_str();
MapiMessage.lpszMessageType = NULL;
MapiMessage.lpszDateReceived = NULL;
MapiMessage.lpszConversationID = NULL;
MapiMessage.flFlags = 0;
MapiMessage.lpOriginator = NULL;
MapiMessage.nRecipCount = 1;
MapiMessage.lpRecips = MapiRecipients;
MapiMessage.nFileCount = 0;
MapiMessage.lpFiles = NULL;

int iErr = SystemTools->SendEmail(&MapiMessage);
switch (iErr)
{
// Error messages
}
}

Can anyone see anything that I've done wrong. As I say, I've cut and pasted
the code identically from one app to the other. One works, the other
doesnt. God forgive me for ever upgrading to Win2003. Using C++Builder 6
Ent, all patches, Win2003 all SP, Outlook 2003 :-)

Helppppppppppppppp


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.