Detailed reference of prototypes, properties and methods available in the
Javascript environment of your Helma web applications.

Default properties and methods of the Mail prototype.
Mail()   deprecated use helma.Mail instead
Helma's built-in mail client enables you to send e-mail via SMTP.

A mail client object is created by using the Mail() constructor. The mail object then can be manipulated and sent using the methods listed below.

You'll need the JavaMail library installed for this to work. Also, don't forget to set your mail server via the smtp property in the app.properties or server.properties file.

Note: Make sure that the SMTP server itself is well-configured, so that it accepts e-mails coming from your server and does not deny relaying. Best and fastest configuration is of course if you run your own SMTP server (e.g. postfix) which might be a bit tricky to set up, however.
methods
  • addBCC(emailString, nameString)
  • addCC(emailString, nameString)
  • addTo(emailString, nameString)
  • setTo(emailString, nameString)
see
Methods
Mail. addBCC(emailString, nameString)
Adds a recipient to the list of addresses to get a "blind carbon copy" of an e-mail message.

The emailString argument specifies the receipient's e-mail address. The optional nameString argument specifies the name of the recipient.

Example:
var mail = new Mail();
mail.addBCC("hop@helma.at");
mail.addBCC("tobi@helma.at", "Tobi Schaefer");
parameters
String emailString as String, receipients email address
String nameString as String, optional receipients name
Mail. addCC(emailString, nameString)
Adds an address to the list of carbon copy recipients.

The emailString argument specifies the receipient's e-mail address. The optional nameString argument specifies the name of the recipient.

Example:
var mail = new Mail();
mail.addCC("hop@helma.at");
mail.addCC("tobi@helma.at", "Tobi Schaefer");
parameters
String emailString as String, receipients email address
String nameString as String, optional receipients name
Mail. addPart(File, nameString)
Adds an attachment to an e-mail message.

The attachment needs to be either a MIME Object or a java.io.file object.

Use the getURL() function to retrieve a MIME object or wrap a java.io.File object around a file of the local file system.

Example:
var file1 = getURL("http://localhost:8080/static/image.gif");
var file2 = getURL("file:////home/snoopy/woodstock.jpg");
var file3 = new java.io.File("/home/snoopy/woodstock.jpg");
var mail = new Mail();
mail.addPart(file1);
mail.addPart(file2);
mail.addPart(file3);
 
mail.setFrom("snoopy@doghouse.com");
mail.setTo("woodstock@birdcage.com");
mail.setSubject("Look at this!");
mail.addText("I took a photograph from you. Neat, isn't it? -Snoop");
mail.send();
parameters
fileOrMimeObject File or Mime object to attach to the email
String nameString as String, optional name of the attachment
see
Mail. addText(text)
Appends a string to the body text of an e-mail message.

Example:
var mail = new Mail();
mail.addText("Hello, World!");
parameters
String text as String, to be appended to the message body
Mail. addTo(emailString, nameString)
Adds a recipient to the address list of an e-mail message.

The emailString argument specifies the receipient's e-mail address. The optional nameString argument specifies the name of the recipient.

Example:
var mail = new Mail();
mail.setTo("hop@helma.at");
mail.addTo("hopdoc@helma.at");
mail.addTo("tobi@helma.at", "Tobi Schaefer");
parameters
String emailString as String, receipients email address
String nameString as String, optional receipients name
see
Mail. send()
Sends an e-mail message.

This function sends the message created with the Mail object using the SMTP server as specified in either the app.properties or the server.properties file.

Example:
var mail = new Mail();
mail.setTo("watching@michi.tv", "michi");
mail.addCC("franzi@home.at", "franzi");
mail.addBCC("monie@home.at");
mail.setFrom("chef@frischfleisch.at", "Hannes");
mail.setSubject("Registration Conformation");
mail.addText("Thanks for your Registration...");
mail.send();
Mail. setFrom(emailString, nameString)
Sets the sender of an e-mail message.

The emailString argument specifies the receipient's e-mail address. The optional nameString argument specifies the name of the recipient.

Example:
var mail = new Mail();
mail.setFrom("tobi@helma.at", "Tobi Schaefer");
parameters
String emailString as String, sender email address
String nameString as String, optional sender name
Mail. setSubject(subject)
Sets the subject of an e-mail message.

Example:
var mail = new Mail();
mail.setSubject("Hello, World!");
parameters
String subject as String, the email subject
Mail. setTo(emailString, nameString)
Sets the recipient of an e-mail message.   The emailString argument specifies the receipient's e-mail address. The optional nameString argument specifies the name of the recipient.

Example:
var mail = new Mail();
mail.setTo("hop@helma.at");
parameters
String emailString as String, receipients email address
String nameString as String, optional receipients name
see
Fri, 05 Feb 2010 17:40:05 GMT.

core framework

optional modules

java libraries

properties files