## Mail

    Object
       |
       +--Mail

Deprecated use {link helma.Mail} instead
Defined in Mail.js

SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods

Constructor Summary
`Mail()` Helma's built-in mail client enables you to send e-mail via SMTP.

Methods Summary
`void` | `addBCC(<String> emailString, <String> nameString)` Adds a recipient to the list of addresses to get a "blind carbon copy" of an e-mail message.
`void` | `addCC(<String> emailString, <String> nameString)` Adds an address to the list of carbon copy recipients.
`void` | `addPart(fileOrMimeObject, <String> nameString)` Adds an attachment to an e-mail message.
`void` | `addTo(<String> emailString, <String> nameString)` Adds a recipient to the address list of an e-mail message.
`void` | `send()` Sends an e-mail message.
`void` | `setFrom(<String> emailString, <String> nameString)` Sets the sender of an e-mail message.
`void` | `setSubject(<String> subject)` Sets the subject of an e-mail message.
`void` | `setTo(<String> emailString, <String> nameString)` Sets the recipient of an e-mail message.
`<static> void` | `addText(<String> text)` Appends a string to the body text of an e-mail message.

Constructor Detail

### Mail

    Mail()

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.

Deprecated use {link helma.Mail} instead

Method Detail

### addBCC

    void addBCC(<String> emailString, <String> 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:

`emailString` - as String, receipients email address

`nameString` - as String, optional receipients name

### addCC

    void addCC(<String> emailString, <String> 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:

`emailString` - as String, receipients email address

`nameString` - as String, optional receipients name

### addPart

    void addPart(fileOrMimeObject, <String> 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:

`nameString` - as String, optional name of the attachment

`File` - or Mime object to attach to the email

See:

- global.getUrl
- mimePart
- java.io.File

### addTo

    void addTo(<String> emailString, <String> 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:

`emailString` - as String, receipients email address

`nameString` - as String, optional receipients name

See:

- setTo

### send

    void 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();

### setFrom

    void setFrom(<String> emailString, <String> 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:

`emailString` - as String, sender email address

`nameString` - as String, optional sender name

### setSubject

    void setSubject(<String> subject)

Sets the subject of an e-mail message.
Example:

     var mail = new Mail();
     mail.setSubject("Hello, World!");

Parameters:

`subject` - as String, the email subject

### setTo

    void setTo(<String> emailString, <String> 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:

`emailString` - as String, receipients email address

`nameString` - as String, optional receipients name

See:

- addTo()

### addText

    <static> void addText(<String> text)

Appends a string to the body text of an e-mail message.
Example:

     var mail = new Mail();
     mail.addText("Hello, World!");

Parameters:

`text` - as String, to be appended to the message body

SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods

Documentation generated by JSDoc on Thu Apr 5 01:59:00 2007