Server-side object | |
Implemented in | Netscape Server 3.0 |
The
To
and From
attributes are required. All other properties are optional.
Created by
The SendMail
constructor:
new SendMail();
Parameters
None.
Description
Whatever properties you specify for the SendMail
object are sent in the header of the mail message.
The SendMail
object allows you to send either simple text-only mail messages or complex MIME-compliant mail or add attachments to your message. To send a MIME message, set the Content-Type
property to the MIME type of the message.
You can use the prototype
property of the SendMail
object to add a property to all SendMail
instances. If you do so, that addition applies to all SendMail
objects running in all applications on your server, not just in the single application that made the change. This allows you to expand the capabilities of this object for your entire server.
Property Summary
Examples
Example 1: The following script sends mail to vpg and gwp, copying jaym, with the specified subject and body for the message:
<server>
Example 2: The following example sends an image in a GIF file:
SMName = new SendMail();
SMName.To = "[email protected], [email protected]"
SMName.From = "[email protected]"
SMName.Cc = "[email protected]"
SMName.Subject = "The State of the Universe"
SMName.Body = "The universe, contrary to what you may have heard, is in none too shabby shape. Not to worry! --me"
SMName.send()
</server>sm = new SendMail();
Example 3: The following example sends a multipart message:
sm.To = "satish";
sm.From = "[email protected]";
sm.Smtpserver = "fen.mcom.com";
sm["Errors-to"] = "satish";
sm["Content-type"] = "image/gif";
sm["Content-Transfer-Encoding"] = "base64";
file = new File("/u/satish/LiveWire/mail/banner.gif");
openFlag = file.open("r");
if ( openFlag ) {
len = file.getLength();
str = file.read(len);
sm.Body = str;
}
sm.send();sm = new SendMail();
The file
sm.To = "[email protected], [email protected]";
sm.From = "[email protected]";
sm.Smtpserver = "fen.mcom.com";
sm.Organization = "Netscape Comm Corp";
sm["Content-type"] = "multipart/mixed; boundary=\"------------8B3F7BA67B67C1DDE6C25D04\"";
file = new File("/u/satish/LiveWire/mail/mime");
openFlag = file.open("r");
if ( openFlag ) {
len = file.getLength();
str = file.read(len);
sm.Body = str;
}
sm.send(); mime
has HTML text and an Microsoft Word document separated by the specified boundary. The resulting message appears as HTML text followed by the Microsoft Word attachment.
Properties
Bcc
Comma-delimited list of recipients of the message whose names should not be visible in the message.
Property of |
SendMail
|
Implemented in | Netscape Server 3.0 |
Property of |
SendMail
|
Implemented in | Netscape Server 3.0 |
Cc
Comma-delimited list of additional recipients of the message.
Property of |
SendMail
|
Implemented in | Netscape Server 3.0 |
Errorsto
Address to which to send errors concerning the message. Defaults to the sender's address.
Property of |
SendMail
|
Implemented in | Netscape Server 3.0 |
From
User name of the person sending the message.
Property of |
SendMail
|
Implemented in | Netscape Server 3.0 |
Organization
Organization information.
Property of |
SendMail
|
Implemented in | Netscape Server 3.0 |
prototype
Represents the prototype for this class. You can use the prototype to add properties or methods to all instances of a class. For information on prototypes, see Function.prototype
.
Property of |
SendMail
|
Implemented in | LiveWire 1.0 |
Replyto
User name to which replies to the message should be sent. Defaults to the sender's address.
Property of |
SendMail
|
Implemented in | Netscape Server 3.0 |
Smtpserver
Mail (SMTP) server name. Defaults to the value specified through the setting in the Administration server.
Property of |
SendMail
|
Implemented in | Netscape Server 3.0 |
Subject
Subject of the message.
Property of |
SendMail
|
Implemented in | Netscape Server 3.0 |
To
Comma-delimited list of primary recipients of the message.
Property of |
SendMail
|
Implemented in | Netscape Server 3.0 |
Methods
errorCode
Returns an integer error code associated with sending this message.
Method of |
SendMail
|
Implemented in | Netscape Server 3.0 |
Syntax
public errorCode();
Returns
The possible return values and their meanings are as follows:
errorMessage
Returns a string associated with sending this message.
Method of |
SendMail
|
Implemented in | Netscape Server 3.0 |
Syntax
public errorMessage();
Returns
An error string.
send
Sends the mail message represented by this object.
Method of |
SendMail
|
Implemented in | Netscape Server 3.0 |
Syntax
public send ();
Returns
This method returns a Boolean value to indicate whether or not the mail was successfully sent. If the mail was not successfully sent, you can use the errorMessage
and errorCode
methods to determine the nature of the error.
This method returns a string indicating the nature of the error that occurred sending the message.
Last Updated: 10/31/97 16:37:22