Maptitude GISDK Help |
Sends emails.
Utilities.Mail(array opts)
Initializes a new instance of the email class.
Option |
Type |
Description |
|
opts |
array | ||
Server |
string |
Name of server name |
|
Port |
int |
Port number |
Name |
Type |
Contents |
|
From |
string |
Field id route ID in route system. |
|
UseDefaultCredentials |
boolean |
Send email using default credentials. If false, a credentials dbox will prompt you to enter the credentials |
|
Credentials |
array |
Optional, UserName and Password. If not set, dbox will pop up |
|
Server |
string |
Name of email server name |
|
Port |
int |
SMTP Port number |
|
EnableSSL |
boolean |
Use SSL connection |
AddTo(string sz)
Add email address.
AddCc(string sz)
Add email address.
ResetCredentials()
Delete cached email credentials.
Send(array opts)
Send email based on the following array of options.
Option |
Type |
Description |
|
opts |
|||
Subject |
string |
Subject line text |
|
Body |
string |
Body text string, can be html code |
|
BodyText |
string |
Name of file containing the email body text. Otherwise use the body text |
|
Attachments |
array |
Array of file name strings |
macro "SendMail"
on error do
ShowMessage(GetLastError())
return()
end
// configure mail client
mail = CreateObject("Utilities.Mail", {Server: ServerName, Port: PortNumber})
mail.From = "mymail@mail.com"
mail.AddTo("mail_1@mail.com")
mail.AddCc("mail_2@mail.com")
mail.UseDefaultCredentials = false
mail.Credentials = {UserName: "mymail@somemail.com", Password: "pw123"}
mail.IsBodyHtml = true
mail.EnableSSL= true
// Construct mail message
message.Subject = "This is a test of the mail Utility "
message.Body = "<h1>Model Run Information</h1> Model finished successfully."
// setup attachments
// FileToAttach = RunMacro("G50 program folder") + "copyright.txt"
// message.Attachments = {FileToAttach}
mail.Send(message)
endmacro
See Also:
©2025 Caliper Corporation | www.caliper.com |