JavaScript API

Search:

Welcome

Login to contribute. Register if you haven't yet.

Need Support?

Search this site to find an answer. If you still need help, post a Question. Private or account-related support inquiries can be made at the Private Support forum.

Stay Informed

Are you receiving EditMe's monthly newsletter? Keep informed of product changes, tutorials and tips. Sign up here.

JavaScript API Class: Email

The Email class represents a single email message, which can contain multiple recipients. Instances of the email class are created with the server.newEmail() function.

Functions

Name  Return Type
Description 
addBcc (String1)  n/a  Adds a BCC: recipient email address.
addBcc (String1, String2)
n/a Adds a BCC: recipient email address with the name specified in String2.
addCc (String1)
n/a
Adds a CC: recipient email address.
addCc (String1, String2)
n/a Adds a CC: recipient email address with the name specified in String2.
addTo (String1)
n/a Adds a To: recipient email address.
addTo (String1, String2)
n/a Adds a To: recipient email address with the name specified in String2.
setFrom (String1, String2)  n/a  Sets the From recipient email address (String1) and name (String2).
setFrom (String1)
n/a Sets the From recipient email address. 
setHtml (String1) n/a
Sets the HTML portion of the message. If blank, a text-only message will be sent. At least one of setHtml or setText must be called before send().
setSubject (String1)
n/a
Sets the message subject.
setText (String1)
n/a
Sets the text portion of the message. If setHtml is called, an HTML message will be sent. At least one of setHtml or setText must be called before send().
send()
n/a
Sends the message.


Example

var msg = server.newEmail();
msg.setFrom('name@domain.com', 'Jane Doe');
msg.setSubject('Test Message');
msg.addTo('recipient@domain.com', 'Helen Doe');
msg.setText('This is a test message.');
try {
  msg.send(); 
} catch (e) {
  var errorMsg = 'Sending email failed: ' + e;
} 

 
Return to Java Script API


EditMe News & Blog