Call Outlook in C Builder Send Mail
1) First, add #include "mapi.hpp" in the CPP file.
Write down the following code when you need to call the email: void __fastcall tform1 :: button1click (TOBJECT * Sender) {
TMAPIMESSAGE MAPIMESSAGE; Cardinal Merror;
MapiMessage.ulReserved = 0; MapiMessage.lpszSubject = NULL; MapiMessage.lpszNoteText = RichEdit1-> Lines-> Text.c_str (); MapiMessage.lpszMessageType = NULL; MapiMessage.lpszDateReceived = NULL; MapiMessage.lpszConversationID = NULL; MapiMessage.flFlags = 0; mapimessage.lporiginator = null; mapimessage.nrecipcount = 0; mapimessage.lprecips = null; mapimessage.nfilecount = 0; mapimessage.lpfiles = null;
Merror = mapisndmail (0, Reinterpret_cast
IF (Merror) ShowMessage ("Send Mail Errors!");
}
This will call Outlook to send an email.