|
 |
The Email object sends an email message from within a script. You can send email by calling the send() method directly on the Email prototype object and passing in all arguments, or creating an instance of an Email object, setting its properties individually, and then calling the send() method.
Alternatively, you can use the <ws:email> element to send email from script. Within the opening and closing <ws:email> tags, you can specify the fields to construct an Email object using a single text string. See Sending Email from Script in the "DataWeb Script Language Enhancements" discussion for more details about sending email with <ws:email> tags. Which syntax you use is a matter of personal preference, however.
Constructor
[new]
Email(to, from, replyTo,
cc, bcc, subject,
body[, contentType]) |
Returns a newly constructed Email object instance. The arguments specify the properties of the Email object instance. |
|
Instance Properties
to |
Specifies the recipient(s) of the email message. |
from |
Specifies
the sender of the email message. DataWeb
Internet headers are attached to sent messages. |
replyTo |
Specifies the reply-to address for the email message. If left blank, the value of the from property will be used as a reply-to address. |
cc |
Specifies the carbon-copy recipients of the email message. |
bcc |
Specifies the blind carbon-copy recipients of the email message. |
subject |
Specifies the subject of the email message. |
body |
Specifies the body of the email message. |
contentType |
Specifies the content type for the email message. If left undefined, contentType will be set to "text/plain." The other common value is "text/html." |
|
Instance Method
send |
Sends
an email message. When
send is called on an instance of the prototype
Email object, the properties of the instance object must be defined explicitly. |
|
Prototype Method
send |
Sends an email message. |
|
The first example below demonstrates
calling the send() method of the prototype object. The
second example creates a new Email object instance, defines its properties, and then
sends it:
//Example #1: Using the Prototype Email object
Email.send("johnsmith@DataWeb.com", "marysmith@DataWeb.com",
"marysmith@DataWeb.com", "", "",
"Mary Smith sick today",
"I am sick today and I will not be coming into work. - Mary",
"text/html");
//Example #2: Using an instance of the Email object
var mmMessage = new Email();
mmMessage.to = "johnsmith@DataWeb.com";
mmMessage.from = "marysmith@DataWeb.com";
mmMessage.replyTo = "marysmith@DataWeb.com";
mmMessage.cc = "";
mmMessage.bcc = "";
mmMessage.subject = "Mary Smith sick today";
mmMessage.body = "I am sick today
and I will not be coming into work. -Mary";
mmMessage.contentType = "text/html";
mmMessage.send();
|