Section 13.6: pop Up Chapter 13: Aubit4GL Packages Section 13.8: string 

13.7 smtp

This allows you to send email from your 4GL program. This module is also required if you wish to use ’REPORT TO EMAIL’ from within your 4GL application.

13.7.1 Dependancies

A patched libsmtp -

13.7.2 Function list set_errmsg

Displays the specified message and exits the program
set_errmsg(lv_msg) clear_err

Clears down any active smtp error message/error number
clear_err() set_server

Sets the name of the smtp server to use.
set_server(lv_server) get_server

Gets the name of the smtp server to use. If no server has been specified via the set_server function, then the SMTP_SERVER environment variable will be used instead. If no SMTP_SERVER is specified, ’mail’ is used.
get_server() get_errmsg

Returns the last generated error message.
get_errmsg() start_message

Start a new message session.
start_message(lv_sender,lv_subject) add_recipient

Add a recipient to a message session.
add_recipient(lv_message,lv_to) mime_type_new

Add a mime section to a message
Normally - if you are using a mime email, you would add two initial sections a mixed part and a text part. You then add any files to the mixed part. Eg:
let lv_mixedpart 
   = fgl_smtp::mime_type_new(lv_message,0,"multipart/mixed")
let lv_textpart 
   = fgl_smtp::mime_type_new(lv_message,lv_mixedpart,"text/plain")
if lv_rep_filename matches "*.pdf" or lv_hint="PDF" then 
   let lv_pdfpart
  let lv_reppart
end if connect

Connect to an smtp server with a given message to send, if no server is specified (ie its null or blank) then the server from get_server will be used.
connect(lv_message,lv_server,lv_port,lv_flags,lv_ismime) disconnet

Closes the connection to the server and indicates that the email is complete and ready for transmision.
disconnect(lv_message) send_to

Add additional recipients to an email message. the ’send_to’ is identical to the ’add_recipient’ function.
send_to_bcc(lv_message,lv_to) part_send_file

This is called to actually send the mime encoding of the file. the order in which these are used must match the order of the mime_type_new sections created previously.
part_send_file(lv_message,lv_file,lv_last) send_report

This is used by the 4GL library to send a report output (via the REPORT TO EMAIL) to the report recipients.
 Section 13.6: pop Up Chapter 13: Aubit4GL Packages Section 13.8: string