Custom email solution

The custom email solution interface consists of these functions:
init.mail.message
Syntax:
     function extern long init.mail.message(
                 ref string o.error.message)
Description:
     Use this function to initialize the email message.
Arguments:
     o.error.message: output argument which contains the error message, or an empty string
Return value: 0 if processing without errors, otherwise the error code
set.mail.sender
Syntax:
     function extern long set.mail.sender (
                 const string i.name,
                 const string i.address,
                 ref string o.error.message)
Description:
     Use this function to add a sender to the email message.
Arguments:
     i.name: input argument which contains the name of the sender
     i.address: input argument which contains the mail address of the sender
     o.error.message: output argument which contains the error message, or an empty string
Return value: 0 if processing without errors, otherwise the error code
add.mail.recipient
Syntax:
     function extern long add.mail.recipient(
                 const string i.role,
                 const string i.name,
                 const string i.address,
                 ref string o.error.message)
Description:
     Use this function to add a mail recipient to the email message. This function can be repeated to add more mail recipients.
Arguments:
     i.role: input argument which contains the recipient’s role. Possible values: to, cc, bcc
     i.name: input argument which contains the name of the recipient
     i.address: input argument which contains the mail address of the recipient
     o.error.message: output argument which contains the error message, or an empty string
Return value: 0 if processing without errors, otherwise the error code
set.mail.subject
Syntax:
     function extern long set.mail.subject(
                 const string i.subject.
                 ref string o.error.message)
Description:
     Use this function to add a mail subject to the email message.
Arguments:
     i.subject: input argument which contains the subject of the mail message
     o.error.message: output argument which contains the error message, or an empty string
Return value: 0 if processing without errors, otherwise the error code
set.mail.body
Syntax:
     function extern long set.mail.body(
                 const string i.body.text.file,
                 const string i.mimetype,
                 ref string o.error.message)
Description:
     Use this function to add a mail body to the email message.
Arguments:
     i.body.text.file: input argument which contains the file name of the body text
     i.mimetype: input argument which contains the mime type of the body text
     o.error.message: output argument which contains the error message, or an empty string
Return value: 0 if processing without errors, otherwise the error code
add.mail.attachment
Syntax:
     function extern long add.mail.attachment(
                 const string i.filename,
                 const string i.displayname,
                 ref string o.error.message)
Description:
     Use this function to add an attachment to the email message.
Arguments:
     i.filename: input argument which contains the name of the file.
     i.displayname: input argument which contains the name to be displayed in the message
     o.error.message: output argument which contains the error message, or an empty string
Return value: 0 if processing without errors, otherwise the error code
send.mail.message
Syntax:
     function extern long send.mail.message(
                 ref string o.error.message)
Description:
     Use this function to send the email message.
Arguments:
     o.error.message: output argument which contains the error message, or an empty string
Return value: 0 if processing without errors, otherwise the error code
cancel.mail.message
Syntax:
     function extern long cancel.mail.message(
                 ref string o.error.message)
Description:
     Use this function to cancel the email message.
Arguments:
     o.error.message: output argument which contains the error message, or an empty string
Return value: 0 if processing without errors, otherwise the error code