Oleobject lole_session, lole_msg, lole_attach
string ls_address
integer li_rc
integer i
lole_session = CREATE OLEObject
// Activate the OutLook application and check if it was activated
properly.
li_rc = lole_session.ConnectToNewObject("outlook.application")
IF li_rc <> 0 THEN
gnv_messages.of_display("FRW5003")
DESTROY lole_session
RETURN False
END IF
// Create the message object and set some of its properties such as
tyhe message subject and
// message body.
lole_msg = CREATE OLEObject
lole_msg = lole_session.CreateItem(0)
lole_session.
lole_msg.Subject = as_subject
lole_msg.Body = as_message_text
// Set the list of files attached to the message
IF UpperBound(as_file_attachments[]) > 0 THEN
lole_attach = CREATE OLEObject
lole_attach = lole_msg.Attachments
FOR i = 1 TO UpperBound(as_file_attachments[])
lole_attach.Add(as_file_attachments[i])
END FOR
END IF
// Set the list of addresses for the "To" section (seperated by
semicolons)
IF UpperBound(as_address[]) > 0 THEN
ls_address = as_address[1]
FOR i = 2 TO UpperBound(as_address[])
IF as_address[i] > "" THEN
ls_address += "; " + as_address[i]
END IF
END FOR
lole_msg.To = ls_address
END IF
// If requested: Display the outlook application message window
IF ab_show_outlook_application THEN
lole_msg.Display
END IF
// If requested: Send the message
IF ab_send_message THEN
lole_msg.Send //send the message
END IF
DESTROY lole_session
DESTROY lole_msg
// If requested, then delete the attached files
this.of_delete_temp_files(ab_delete_files_after_send,
as_file_attachments)
RETURN True