OPTIONS "WINFUNC NOSOURCE C_CALL"
NUMERIC DIGITS 10
DO
mapirecipdesc = "32u, 32u, str *, str *, 32u, void"
mapimessage = "32u, str *, str *, void, str *, void, 32u, struct MapiRecipDesc *, 32u, struct MapiRecipDesc *, 32u, void"
FUNCDEF("SendOneEMail", "32u, void, void, struct MapiMessage, 32u, 32u", "mapi32", "MAPISendMail")
FUNCDEF("MAPILogon", "32u, void, str, str, 32u, 32u, void stor", "mapi32")
FUNCDEF("MAPILogoff", "32u, void, void, 32u, 32u", "mapi32")
CATCH FAILURE
CONDITION("M")
RETURN
END
err = mapilogon(, , , 1 + 8 + 4095, , session)
IF err == 0 THEN DO
mailmessage.1 = 0
mailmessage.2 = "Subject line"
mailmessage.3 = "Here is the message body of the email" || '0D0A'x || "Line #2"
mailmessage.4 = 0
PARSE VALUE TIME('N') WITH hour ':' MIN ':' .
mailmessage.5 = LEFT(DATE('S'), 2) || DATE('O') hour || ':' || MIN
mailmessage.6 = 0
mailmessage.7 = 1
mailmessage.8.1 = 0
mailmessage.8.2 = 0
mailmessage.8.3 = "Jeff Glatt"
mailmessage.8.4 = "jglatt@borg.com"
mailmessage.8.5 = 0
mailmessage.8.6 = 0
mailmessage.9 = 1;
mailmessage.10.1 = 0
mailmessage.10.2 = 1
mailmessage.10.3 = "Jeff Glatt"
mailmessage.10.4 = "jglatt@borg.com"
mailmessage.10.5 = 0
mailmessage.10.6 = 0
mailmessage.11 = 0
mailmessage.12 = 0
err = sendoneemail(session, , mailmessage, 1)
IF err \== 0 THEN saymapierrmessage(err, "Sendmail failed:")
FINALLY
mapilogoff(session)
END
ELSE saymapierrmessage(err, "Problem logging into MAPI:")
RETURN
saymapierrmessage:
SELECT ARG(1)
WHEN 1 THEN SAY "User aborted."
WHEN 3 THEN SAY "There was no default logon, and the user failed to log on successfully when the logon dialog box was displayed."
WHEN 4 THEN SAY "Can't save attachment because disk is full."
WHEN 5 THEN SAY "Need more memory to send/receive email."
WHEN 6 THEN SAY "Access denied."
WHEN 8 THEN SAY "The user has too many sessions open simultaneously."
WHEN 9 THEN SAY "Too many attachments."
WHEN 10 THEN SAY "Too many recipients."
WHEN 11 THEN SAY "Attachment not found."
WHEN 12 THEN SAY "Can't open an attachment."
WHEN 13 THEN SAY "Can't save an attachment to a temporary file."
WHEN 14 THEN SAY "A recipient did not appear in the address list."
WHEN 15 THEN SAY "Recipient name is specified incorrectly."
WHEN 16 THEN SAY "No messages."
WHEN 17 THEN SAY "Invalid message ID."
WHEN 18 THEN SAY "The text in the message was too large to send."
WHEN 19 THEN SAY "Invalid session."
WHEN 20 THEN SAY "Type not supported."
WHEN 21 THEN SAY "A recipient was specified more than once."
WHEN 22 THEN SAY "Message in use."
WHEN 23 THEN SAY "Network failure."
WHEN 25 THEN SAY "Invalid recipients."
OTHERWISE SAY ARG(2) err
END
RETURN |
|