Article View: borland.public.cppbuilder.internet.web
Article #737Re: How display MAPIMAIL
From: RS
Date: Fri, 03 Mar 2006 20:53
Date: Fri, 03 Mar 2006 20:53
111 lines
5305 bytes
5305 bytes
Hey Hey Hey !!!
I'm finding this following source code, and it works with outlook 2003 !!!
I'm finally 2 sources codes that works with the 2 softwares OE and Ms
Outlook.
I want to identify which software is the mapi default program, how can I
find this ?
//-------------------------------------------------------------
LPMAPISENDMAIL pfnSendMail;
MapiRecipDesc rdOriginator;
MapiRecipDesc rdRecipient[1];
LPMAPILOGOFF pfnLogoff;
LPMAPILOGON pfnLogon;
MapiMessage mapimsg;
HINSTANCE hDll;
LHANDLE lHnd;
MapiFileDesc mapifiledesc[2];
if(NULL == (hDll = LoadLibrary(TEXT("MAPI32.DLL"))))
{
_tprintf(TEXT("could not load mapi32.dll, ErrorCode: %u"),
GetLastError());
}
pfnLogon = (LPMAPILOGON)GetProcAddress(hDll, "MAPILogon");
pfnLogoff = (LPMAPILOGOFF)GetProcAddress(hDll, "MAPILogoff");
pfnSendMail = (LPMAPISENDMAIL)GetProcAddress(hDll, "MAPISendMail");
pfnLogon(0, NULL, NULL, 0, 0, &lHnd);
mapimsg.ulReserved = 0;
mapimsg.lpszSubject = "This is the Subject";
mapimsg.lpszNoteText = "This is the Body Message";
mapimsg.lpszMessageType = NULL;
mapimsg.lpszDateReceived = NULL;
mapimsg.lpszConversationID = NULL;
mapimsg.flFlags = MAPI_UNREAD;
mapimsg.lpOriginator = &rdOriginator;
mapimsg.nRecipCount = NUM_ELEMENTS(rdRecipient);
mapimsg.lpRecips = rdRecipient;
mapimsg.nFileCount = 2;
mapimsg.lpFiles = &mapifiledesc[0];
rdOriginator.ulReserved = 0;
rdOriginator.ulRecipClass = MAPI_ORIG;
rdOriginator.lpszName = "rdOriginator";
rdOriginator.lpszAddress = "adresse@expediteur.com"; // Expediteur
rdOriginator.ulEIDSize = 0;
rdOriginator.lpEntryID = NULL;
rdRecipient[0].ulReserved = 0;
rdRecipient[0].ulRecipClass = MAPI_TO;
rdRecipient[0].lpszName = "Name";
rdRecipient[0].lpszAddress = "adresse@destinataire.com"; //
Destinataire
rdRecipient[0].ulEIDSize = 0;
rdRecipient[0].lpEntryID = NULL;
mapifiledesc[0].ulReserved = 0;
mapifiledesc[0].flFlags = 0;
mapifiledesc[0].nPosition = -1;
mapifiledesc[0].lpszPathName = "C:\\test.txt";
mapifiledesc[0].lpszFileName = "test.txt";
mapifiledesc[0].lpFileType = 0;
mapifiledesc[1].ulReserved = 0;
mapifiledesc[1].flFlags = 0;
mapifiledesc[1].nPosition = -1;
mapifiledesc[1].lpszPathName = "C:\\test.pdf";
mapifiledesc[1].lpszFileName = "test.pdf";
mapifiledesc[1].lpFileType = 0;
pfnSendMail(lHnd,0, &mapimsg,MAPI_DIALOG,0);
pfnLogoff(lHnd, 0, 0, 0);
FreeLibrary(hDll);
//------------------------------------------------------------------------------------
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> a οΏ½crit dans le message de news:
4408a934@newsgroups.borland.com...
>
> "Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
> news:4408a7d4$1@newsgroups.borland.com...
>
>> I can't answer that. I just tried it on Outlook 2000 and got the same
>> error. Removing the attachments results in error 2 (MAPI_E_FAILURE)
>> being
>> reported instead of 11.
>
> I can tell you, though, that I use similar code on other machines and it
> works fine. However, that code is logging into an actual mail profile
> (specifying a non-empty string for the lpszProfileName parameter), whereas
> the code in this discussion in not. That might make a difference. You
> can
> look up the default profile in the Registry:
>
> Under Win9x/Me:
> HKCU\Software\Microsoft\Windows Messaging Subsystem\Profiles
> "DefaultProfile"="the name of the default profile"
>
> Under WinNT/2K/XP/2K3:
> HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging
> Subsystem\Profiles
> "DefaultProfile"="the name of the default profile"
>
>
> Gambit
>
>
Technical Details
Message-ID:
<4408ac02@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!news.code-werk.net!open-news-network.org!news.soft-gems.net!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mailReferences:
<4402040f@newsgroups.borland.com> <4404bbf5$1@newsgroups.borland.com> <4404fe85$1@newsgroups.borland.com> <440602dc$1@newsgroups.borland.com> <44064ed2$1@newsgroups.borland.com> <44073e03$1@newsgroups.borland.com> <4407681b$1@newsgroups.borland.com> <44088be9@newsgroups.borland.com> <44088e3f$1@newsgroups.borland.com> <4408910d@newsgroups.borland.com> <4408a7d4$1@newsgroups.borland.com> <4408a934@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,b415d4e666b19fd4 X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII From: "RS" <rs.reloaded@wanadoo.fr> Newsgroups: borland.public.cppbuilder.internet.web References: <4402040f@newsgroups.borland.com> <4404bbf5$1@newsgroups.borland.com> <4404fe85$1@newsgroups.borland.com> <440602dc$1@newsgroups.borland.com> <44064ed2$1@newsgroups.borland.com> <44073e03$1@newsgroups.borland.com> <4407681b$1@newsgroups.borland.com> <44088be9@newsgroups.borland.com> <44088e3f$1@newsgroups.borland.com> <4408910d@newsgroups.borland.com> <4408a7d4$1@newsgroups.borland.com> <4408a934@newsgroups.borland.com> Subject: Re: How display MAPIMAIL Date: Fri, 3 Mar 2006 21:53:57 +0100 Lines: 113 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2670 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 83.196.36.42 Message-ID: <4408ac02@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1141419010 83.196.36.42 (3 Mar 2006 12:50:10 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!news.code-werk.net!open-news-network.org!news.soft-gems.net!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail