Object | +--helma.Mail
This class provides functionality to sending
Email messages.
A mail client object is created by using the helma.Mail()
constructor. The mail object then can be manipulated and sent
using the methods listed below.
You will either need to set your mail server via the smtp
property in the app.properties or server.properties file
or pass the hostname of the mail server you want to use as a
parameter to the constructor.
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.
| SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods |
| Constructor Summary | |
helma.Mail(host, port)
Mail client enabling you to send e-mail via SMTP using Packages.javax.mail. |
|
| Properties Summary | |
Object |
status
The status of this Mail object. |
| Methods Summary | |
void
|
addBCC(<String> addstr, <String> name)
Adds a recipient to the list of addresses to get a "blind carbon copy" of an e-mail message. |
void
|
addCC(<String> addstr, <String> name)
Adds a recipient to the list of addresses to get a "carbon copy" of an e-mail message. |
void
|
addPart(<fileOrMimeObjectOrString> obj, <String> filename, <String> contentType)
Adds an attachment to an e-mail message. |
void
|
addText(<String> text)
Appends a string to the body text of an e-mail message. |
void
|
addTo(<String> addstr, <String> name)
Adds a recipient to the address list of an e-mail message. |
javax.mail.internet.MimeMessage
|
getMessage()
Returns the wrapped message |
String
|
getMultipartType(messageType)
Returns the MIME multiparte message subtype. |
String
|
getSource()
Returns the source of this mail as RFC 822 formatted string. |
void
|
send()
Sends an e-mail message. |
void
|
setAuthentication(<String> uname, <String> pwd)
Sets username and password to use for SMTP authentication. |
void
|
setDebug(<Boolean> debug)
Switches debug mode on or off. |
void
|
setFrom(<String> addstr, <String> name)
Sets the sender of an e-mail message. |
void
|
setMultipartType(<String> messageType)
Sets the MIME multiparte message subtype. |
void
|
setReplyTo(<String> addstr)
Sets the Reply-To address of an e-mail message. |
void
|
setSubject(<String> subject)
Sets the subject of an e-mail message. |
void
|
setText(<String> text)
Sets the body text of an e-mail message. |
void
|
setTo(<String> addstr, <String> name)
Sets the recipient of an e-mail message. |
void
|
writeToFile(<helma.File> dir)
Saves this mail RFC 822 formatted into a file. |
<static> void
|
example(host, sender, addr, subject, text)
|
| Constructor Detail |
helma.Mail(host, port)
smtp - as String, the hostname of the mail server
| Properties Detail |
Object status
0 unless
an error occurred. See Mail.js source code for a list of
possible error codes.
| Method Detail |
void addBCC(<String> addstr, <String> name)
addstr - as String, receipients email address
name - as String, optional receipients name
void addCC(<String> addstr, <String> name)
addstr - as String, receipients email address
name - as String, optional receipients name
void addPart(<fileOrMimeObjectOrString> obj, <String> filename, <String> contentType)
obj - File, Mime object or String to attach to the email
filename - optional name of the attachment
contentType - optional content type (only if first argument is a string)
void addText(<String> text)
text - as String, to be appended to the message body
void addTo(<String> addstr, <String> name)
addstr - as String, receipients email address
name - as String, optional receipients name
javax.mail.internet.MimeMessage getMessage()
String getMultipartType(messageType)
String getSource()
void send()
void setAuthentication(<String> uname, <String> pwd)
uname - The username to use
pwd - The password to use
void setDebug(<Boolean> debug)
debug - If true debug mode is enabled
void setFrom(<String> addstr, <String> name)
addstr - as String, sender email address
name - as String, optional sender name
void setMultipartType(<String> messageType)
messageType - the MIME subtype such as "mixed" or "alternative".
void setReplyTo(<String> addstr)
addstr - as String, the reply-to email address
void setSubject(<String> subject)
subject - as String, the email subject
void setText(<String> text)
text - as String, to be appended to the message body
void setTo(<String> addstr, <String> name)
addstr - as String, receipients email address
name - as String, optional receipients name
void writeToFile(<helma.File> dir)
dir - An optional directory where to save this mail to. If omitted the mail will be saved in the system's temp directory.
<static> void example(host, sender, addr, subject, text)
| SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods |