Default properties and methods of
the Mail prototype.
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.
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)
- addPart(File, nameString)
- addTo(emailString, nameString)
- send()
- setFrom(emailString, nameString)
- setSubject(subject)
- setTo(emailString, nameString)
see
Methods
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:
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 |
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:
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 |
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:
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
Appends a string to the body text of an e-mail message.
Example:
Example:
var mail = new Mail(); mail.addText("Hello, World!");
parameters
String | text | as String, to be appended to the message body |
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:
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
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:
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();
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:
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 |
Sets the subject of an e-mail message.
Example:
Example:
var mail = new Mail(); mail.setSubject("Hello, World!");
parameters
String | subject | as String, the email subject |
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:
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