Page History
...
Below is a sample program which sends an email, using the above 3 steps. Note the error testing logic after each function call. Refer to MAPI_Equates for a list of commands and flags that can be sent to the MAPI type functions, and the error codes returned.
Info |
---|
A good test of MAPI functions is to send an email to yourself. Make Make the From: and To: entries entries your email address. Then Then see if, after you run the program, the email shows up in your in box.
|
Info |
---|
Depending on your email settings, the login dialog may display whether or not you have set the MAPI_LOGON_UI$ flag. For For example, there is a security setting in Microsoft Outlook Express that forces the login dialog to display. Each Each email environment is different. Check Check with your email administrator.
|
...
Code Block |
---|
declare function MAPILogon , MAPISendMail, MAPILogoff declare subroutine msg, get_status $insert MAPI_Equates session = '' parent = @window user = '' password = '' // Logon to MAPI with prompt if MAPILogon (session, @window,user, password, MAPI_LOGON_UI$ + MAPI_NEW_SESSION$) then /* Note: if you know the profile (such as Outlook Internet Settings) to log into the mail system, call MapiLogon() as shown below if MAPILogon (session, @window , 'Outlook Internet Settings', '') then */ Msg(@window, "Mail login successful!") End Else Get_Status(ErrMsg) Msg(@window, ErrMsg) End // Send an email, requesting a receipt. Flags = MAPI_RECEIPT_REQUESTED$ + MAPI_DIALOG$ + MAPI_NEW_SESSION$ Message = '' Message<POS_SUBJECT$> = "Send e-mail Test" Message<POS_TO$> = "marketing@yourcompany.com" Message<POS_FROM$> = "info@revelation.com" Message<POS_TEXT$> = "This is a sample Message" Message<POS_FLAGS$> = Flags Message<POS_TYPE$> = "IPM.Microsoft Mail.Note" If MAPISendMail(session, @window, Flags, Message) then * Msg(@window, "Message sent successfully!") End Else Get_Status(ErrMsg) Msg(@window, ErrMsg) End // Logoff from MAPI if MAPILogoff(session) then Msg(@window, "Logoff successful") end else Get_Status(display) Msg(@window, display) end |