AMT Help Files

Email.dll

The external DLL "Email.dll" is not supported anymore in AMT and therefore it also not part of the distribution package. If you still need to use the external Email.dll when migrating old Lion applications to AMT, copy the file Email.dll from the old Lion installation to the directory defined as the 'Call path' in the 'Base paths configuration' of the environment. It is strongly advised that when writing new Lion code to use the e-mail functionality described in E-mail Functions.

This component uses a standard E-mail server supporting SMTP to send mail and POP3 to receive E-mail. All parameters that are passed are to be separated by commas. Also the returned parameters are separated by commas. E-mail addresses have to be entered with “<” and “>”, for example: <someone@provider.com>. The name of a recipient or sender is optional.

The following functions are available:

Common functions:

Functions for logging e-mail:

Functions for sending e-mail:

Functions for receiving e-mail:

Common Functions

SETPARAMSEPARATOR

Specificies the separating character for other EMAIL.DLL functions, such as SETFROM.
The default character is ",".

Input: <separator character>
Result: <spaces> | <errortext>

Example:

 

 si-param := '|'
 call ('SETPARAMSEPARATOR', 'Email.dll')
 si-param := 'abc@asysco.com | def@asysco.com'
 
call ('SETRECIPIENT', 'Email.dll')

Logging functions

DISABLELOGGING

Disables logging.

Input: <spaces>
Result: <spaces> | <errortext>

ENABLELOGGING

Enables logging. Logfile (email.log) will be created in directory of library.

Input: <spaces>
Result: <spaces>

SKIPCONTENTS

Setting this parameter allows skipping the contents in the email.log. 

Example:



 si-param := 'SKIPCONTENTS'
 call ('ENABLELOGGING', 'Email.dll')

The contents are then no longer displayed in the email.log. The setting can be undone with an ENABLELOGGING without the parameter.

Sending e-mail functions

CLEARMESSAGE

Clears all settings done by the SETXX functions.

Input: <none>
Result: <spaces> | <errortext>

Example:

 si-param := ''
 call ('CLEARMESSAGE', 'Email.dll')

SENDLASTRECEIVEDMESSAGE

Sends the content of the last received incoming E-mail message.

Input: <separator character>
Result: <spaces> | <errortext>

Example:

 si-param := ''
 call ('READMESSAGE', 'Email.dll')

 si-param := 'abc@asysco.com'
 call ('SETRECIPIENT', 'Email.dll')

 si-param := 'CC@asysco.com'
 call ('SETCC', 'Email.dll')

 si-param := 'Subject of message'
 call ('SETSUBJECT', 'Email.dll')

 si-param := ''
 call ('SENDLASTRECEIVEDMASSAGE', 'Email.dll')

 si-param := ''
 call ('POP3LOGOFF', 'Email.dll')

SENDMESSAGE

Sends the previous built e-mail to the SMTP server. All needed preparations for sending the e-mail should have been made.

Input : <spaces>
Result: <spaces> | <errortext>

Example:

 si-param := ''
 call ('SENDMESSAGE', 'Email.dll')

SETATTACHMENT

Sets the “ATTACHMENT” of the e-mail. Along with a message, an attachment can be sent. This is to be placed in a separate file. The name of this file is passed as parameter and more than one is permitted.

Example:

 si-param := 'F:\MailAttachments\MyLogo.jpg'
 call ('SETATTACMENT', 'Email.dll')

SETBCC

Sets the "BCC" of the e-mail. More than one address is permitted.

Input : <recipientaddress>[,<recipientaddress>]
Result: <spaces> | <errortext>

Example:

 si-param := 'abc@asysco.com, def@asysco.com'
 call ('SETBCC', 'Email.dll')

SETCC

Sets the “CC” of the e-mail. More than one name and address is permitted.

Input : <recipientaddress>[,<recipientaddress>]
Result: <spaces> | <errortext>

Example:

 si-param := 'abc@asysco.com, def@asysco.com'
 call ('SETCC', 'Email.dll')

SETCONTENTS

Sets the “CONTENTS” of the e-mail. The contents of the e-mail is not passed in a parameter, but is to be placed in a separate file. The name of this file is passed as parameter.

Example:

 si-param := 'F:\Mailmessages\ThisMail.txt'
 call ('SETCONTENTS', 'Email.dll')

SETFROM

Sets the “FROM” of the e-mail. Only one address is permitted.

Input : <senderaddress>>
Result: <spaces> | <errortext>

Example:

 si-param := 'abc@asysco.com'
 call ('SETFROM', 'Email.dll')

SETRECIPIENT

Sets the “TO” of the e-mail. More than one name and address is permitted.

Input : <recipientaddress>[,<recipientaddress>]
Result: <spaces> | <errortext>

Example:

 si-param := 'abc@asysco.com'
 call ('SETRECIPIENT', 'Email.dll')

SETSENDFORMAT

Sets the format of the e-mails that are sent. The format can be either plain text or HTML.

Input: <text> | <html>
Result: <spaces> | <errortext>

Example:

 si-param := 'HTML'
 call ('SETSENDFORMAT', 'Email.dll')

SETSUBJECT

Sets the “SUBJECT” of the e-mail.

Input : <subject>
Result: <spaces> | <errortext>

Example:

 si-param := 'This is the subject of the mail message'
 call ('SETSUBJECT', 'Email.dll')

SMTPLOGOFF

Function to log off from the SMTP server and disconnect.

Input: <spaces>
Result: <spaces> | <errortext>

SMTPLOGON

Function to log on to the SMTP server and connect. Servername and Port address is required as input.

Input: <servername>, <port>
Result: <spaces> | <errortext>

Example:

 si-param := 'SMTP.DDS.NL, 25'
 call ('SMTPLOGON', 'Email.dll')

Receiving E-mail Functions

DELETEMESSAGE

Marks the current e-mail message for deletion. E.g., if you fetch 4 messages from your mailbox and you only use the function DELETEMESSAGE after you fetched the 4th message, than only the 4th message will be deleted. The other 3 messages will be kept on the POP3 server. The DELETEMESSAGE is always the last function that is called within an E-mail receiving routine.

Please note that the physical deletion will only be done at POP3LOGOFF (which is part of the POP3 protocol).

Input: <spaces>
Result: <spaces> | <errortext>

GETATTACHMENTS

Gets the attachments of the e-mail. The attachments are stored in separate files in the requested directory, instead of being passed by a parameter.

spaces: no attachments.
errortxt: error.
att1, att2, etc.

Input : <directoryname>
Result: <spaces> | <errortext> | “OK,” <att1, att2, att3...>

Example:

 si-param := 'F:\IncomingMails\Attachments'
 call ('GETATTACHMENTS', 'Email.dll')
 if si-param <> ''
    si-param := ga-3
    if ga-3 = 'OK,'
       // process attachments
    endif
 endif

GETCCADDRESS

Gets the “CC”-address of the e-mail. More than one could be present and are therefore returned by the dll.

Input: <spaces>
Result: "OK," <E-mail address of CC> | <errortext>

GETCCNAME

Gets the “CC”-name of the e-mail. More than one could be present and are therefore returned by the DLL.

Input: <spaces>
Result: "OK,"<CCName> | <errortext>

GETCONTENTS

Gets the content of the e-mail. The content is stored in a separate file, instead of being passed by a parameter.

Input : <filename>
Result: <spaces> | <errortext>

Example:

 si-param := 'F:\IncomingMails\ThisMail.txt'
 call ('GETCONTENTS', 'Email.dll')
 if si-param = ''
    // Read e-mail message
 endif

GETNROFMESSAGES

Gets the amount of messages at the mailserver. The number of messages is returned by the DLL.

Attention:

If messages are marked for deletion (through a DELETEMESSAGE function), the marks will be removed after the GETNROFMESSAGES is executed. So, this means that these messages will not be deleted physically. This function will also reset the internal messagecount.

Input : <spaces>
Result: <NrofMessages>| "NONE" | <errortext>

GETRECEIVEDDATE

Gets the receiving “DATE” of the e-mail.

Input: <spaces>
Result: "OK,"<date> | <errortext>

GETRECIPIENTADDRESS

Gets the “TO”-address of the e-mail. More than one could be present and are therefore returned by the DLL.

Input: <spaces>
Result: "OK," <Recipientaddress> | <errortext>

GETRECIPIENTNAME

Gets the “TO”-name of the e-mail. More than one could be present and are therefore returned by the DLL.

Input: <spaces>
Result: "OK,"<Recipientname> | <errortext>

GETSENDERADDRESS

Gets the “FROM”-address of the e-mail. More than one could be present and are therefore returned by the DLL.

Input: <spaces>
Result: "OK," <Senderaddress> | <errortext>

GETSENDERNAME

Gets the “FROM”-name of the e-mail. More than one could be present and are therefore returned by the DLL.

Input: <spaces>
Result: "OK,"<Sendername> | <errortext>

GETSUBJECT

Gets the “SUBJECT” of the e-mail.

Input: <spaces>
Result: "OK,"<subject> | <errortext>

POP3LOGOFF

Logs off from the POP3 server and disconnect.

Input: <spaces>
Result: <spaces> | <errortext>

Example:

 si-param := ''
 call ('POP3LOGOFF', 'Email.dll')

POP3LOGON

Logs on to the POP3 server and connect. Servername, port address, user name and password are required as input.

Input: <servername>, <port>, <username>, <password>
Result: <spaces> | <errortext>

Example:

 si-param := 'POP3.DDS.NL, 110, MyAccount, MyPassword'
 call ('POP3LOGON', 'Email.dll')

READMESSAGE

Checks the POP3 server on new e-mail messages for the e-mail account. If this function is performed more than once and there are messages present on the POP3 server, than each time it will fetch the next message. If there are no messages, than the internal message counter will be reset, and a new message that is received can be fetched subsequently.

Spaces: There is a current message.
"NONE": No message available

Input: <spaces>
Result: <spaces> | "NONE" | <errortext>

Example:

 si-param := ''
 call ('READMESSAGE', 'Email.dll')
 if si-param = ''
    call ('GETRECIPIENTNAME', 'Email.dll')
 endif
 ga-3 := si-param
 if ga-3 = 'OK'
    replace (recipient, 1, copy (si-param, 4))
 endif

SETRECEIVEFORMAT

Sets the format of the e-mails that are received. The format can be either plain text or HTML.

Input: <text> | <html>
Result: <spaces> | <errortext>

Example:

 si-param := '<html>'
 call ('SETRECEIVEFORMAT', 'Email.dll')