Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MAPISendMail 1

Status
Not open for further replies.

Rodd

Programmer
Nov 5, 2000
1
0
0
CA
I'm trying to find the library for linking so I can use MAPISendMail in VC++
 
Dear,
This the full code of using the mapi send mail and teh other functions available in the
MAPI.Hope this is helpfull to you.
Just copy the code and compile it and run it in dos prompt.

Bye
JItendar



#include <windows.h>
#include <stdio.h>
#include <mapi.h>

LPMAPILOGON lpfnMAPILogon;
LPMAPISENDMAIL lpfnMAPISendMail;
LPMAPILOGOFF lpfnMAPILogoff;

MapiRecipDesc recipient =
{
0, MAPI_TO,
&quot;Friend&quot;, &quot;SMTP:jitendar.rawat@igiindia.com&quot;,
0, NULL
};

MapiMessage message =
{
0, &quot;Warning&quot;,
&quot;Hello,Jitu how are you\n&quot;,
NULL, NULL, NULL, 0, NULL, 1, &recipient, 0, NULL
};

void main(void)
{
LHANDLE lhSession;
HANDLE hMAPILib;

hMAPILib = LoadLibrary(&quot;MAPI32.DLL&quot;);
lpfnMAPILogon =
(LPMAPILOGON)GetProcAddress(hMAPILib, &quot;MAPILogon&quot;);
lpfnMAPISendMail =
(LPMAPISENDMAIL)GetProcAddress(hMAPILib, &quot;MAPISendMail&quot;);
lpfnMAPILogoff =
(LPMAPILOGOFF)GetProcAddress(hMAPILib, &quot;MAPILogoff&quot;);

(*lpfnMAPILogon)(0, NULL, NULL, 0 , 0, &lhSession);
(*lpfnMAPISendMail)(lhSession, 0, &message, 0, 0);
(*lpfnMAPILogoff)(lhSession, 0, 0, 0);
printf(&quot;Message to the White House sent.\n&quot;);

FreeLibrary(hMAPILib);
}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top