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 - http://libsmtp.berlios.de.

13.7.2 Function list

13.7.2.1 set_errmsg

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

13.7.2.2 clear_err

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

13.7.2.3 set_server

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

13.7.2.4 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() 

13.7.2.5 get_errmsg

Returns the last generated error message.
get_errmsg() 

13.7.2.6 start_message

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

13.7.2.7 add_recipient

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

13.7.2.8 mime_type_new

Add a mime section to a message
mime_type_new(lv_message,lv_part,lv_mimetype) 
mime_type_new_with_description(lv_message,
           lv_part,lv_mimetype,lv_description)
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
    =fgl_smtp::mime_type_new_with_description(lv_message,
           lv_mixedpart,"application/pdf",lv_rep_filename) 
else 
  let lv_reppart
    =fgl_smtp::mime_type_new_with_description(
           lv_message,lv_mixedpart,"text/html",lv_rep_filename) 
end if 

13.7.2.9 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) 

13.7.2.10 disconnet

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

13.7.2.11 send_to

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

13.7.2.12 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_html_listing(lv_message,lv_file,lv_last) 
part_send_file(lv_message,lv_file,lv_last) 

13.7.2.13 send_report

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