AMT Help Files
homeAMT AdminAdvanced FunctionsComScript ModuleAmtEmail Interface

AmtEmail Interface

The AmtEmail object is returned by the CreateAmtEmail function that is provided through the ComScript connection interface. Through this object, the functionality of the AmtEmail utility can be used in programs that are written in any COM supporting development environment.

The following functionality is provided:

Properties

Name Type Access Description
BCC String Read/Write Sets the BCC (blind carbon copy) of the message to be sent. Multiple addresses should be separated by comma's.
CC String Read/Write Sets the CC (carbon copy) of the message to be sent. Multiple addresses should be separated by comma's.
Content String Read/Write Sets the CONTENT of the message to be sent.
From String Read/Write Sets the FROM of the message.
LastErrorMessage String Read Returns the last error message.
ReceivedDate String Read/Write Returns the date that the message was received.
ReplyToStringRead/WriteSets the optional REPLY-TO field. Multiple addresses should be separated by comma's.
Subject String Read/Write Sets the SUBJECT description.
To String Read/Write Sets the TO (recipient specification). Multiple addresses should be separated by comma's.

Functions

Function Name Return type Parameters Description
Name Type
AddAttachment Boolean FileName String Sets the attachment(s) of the e-mail to be sent. A path may be included. Multiple filenames should be separated by a semicolon (;).
ClearMessage Boolean None Clears all settings for the e-mail to be sent.
Connect Void SmtpServerAddress String Test the SMTP connection by sending a HELO command
Port Integer
Name String
Password String
DeleteMessage Boolean None Marks the current received 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.
GetAttachments String Directory String Returns a list with the filenames of the attachments and puts the physical files in the specified directory.
GetNrOfMessages Integer None Returns the number of messages at the mailserver. info Note: 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 message count.
Pop3LogOff Boolean None Logs off and disconnects from the POP3 server.
Pop3LogOn Boolean Server String Logs on to the POP3 server that must be used for fetching the e-mail. The optional parameter to use SSL/TLS defaults to False.
Port Integer
User String
Password String
[UseSSL] Boolean
ReadMessage Boolean MsgNo Integer Checks the POP3 server on new e-mail messages for the e-mail account and fetches all data (in "TO", "CC", "SUBJECT", etc.) of the current e-mail or (if specified) the e-mail to which is pointed through the <Msg no> specification. If this function is performed more than once, then each time it will fetch the next message. If there are no messages, then the internal message counter will be reset, and a new message that is received can be fetched subsequently.
SendLastReveivedMessage Boolean None Sends the last received message to a new destination. In fact, this function is just a forward of the current message.
SendMessage Boolean None Sends the previous built e-mail to the SMTP server. Before executing this instruction, all mandatory preparations for building the e-mail should have been made. When the used e-mail address is in a incorrect format, the function will return false.
SetFormat Boolean Format String Sets the format for the message to be sent. The options are:

'HTML' To set the message in HTML format

'TEXT' To set the message in plain text format.
SmtpLogOff Boolean None Logs off and disconnects from the SMTP server.
SmtpLogOn Boolean Server String Logs on and connects to the SMTP server.
Optional credentials can be used.
The optional parameter to use SSL/TLS defaults to False.
When the logon fails, the function will return false.
Port Integer
[Name] String
[Password] String
[EnableSSL] Boolean

Example

PowerShell

# See ComScript Connection Interface
# ...

$ComScr.Connect()

# Create an AmtEmail object
$AmtEmail = $ComScr.CreateAmtEmail()

# Logon to the SMTP server
$AmtEmail.SmtpLogOn("smtp.example.org", 25)

# Use the properties and functions of the AmtEmail object
$AmtEmail.From = "john@example.org"
$AmtEmail.To = "jane@example.com"
$AmtEmail.Cc = "bob@example.net"
$AmtEmail.BCC = "bill@example.org"
$AmtEmail.Subject = "Testing AmtEmail from a Powershell script"
$AmtEmail.Content = "Test succeeded!!"
$AmtEmail.AddAttachment("attachment.pdf")

# Send the email
$AmtEmail.SendMessage()

# Logoff from the SMTP server
$AmtEmail.SmtpLogOff()

# Finally release the variables and clean up the session.
$ComScr.Dispose()

Contents

 Go to top