javascript 发邮件

SendMail

Sends an email message.

 

服务器端对象

 

实现版本

Netscape Server 3.0

 

 

创建源

The To and From attributes are required. All other properties are optional. The SendMail constructor:

 

参数

new SendMail();

 

描述

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.

 

Bcc

Comma-delimited list of recipients of the message whose names should not be visible in the message.

Body

Text of the message.

Cc

Comma-delimited list of additional recipients of the message.

Errorsto

Address to which to send errors concerning the message. Defaults to the sender's address.

From

User name of the person sending the message.

Organization

Organization information.

prototype

Allows the addition of properties to a SendMail object.

Replyto

User name to which replies to the message should be sent. Defaults to the sender's address.

Smtpserver

Mail (SMTP) server name. Defaults to the value specified through the setting in the Administration server.

Subject

Subject of the message.

To

Comma-delimited list of primary recipients of the message.

 

方法概览

 

 

errorCode

Returns an integer error code associated with sending this message.

errorMessage

Returns a string associated with sending this message.

send

Sends the mail message represented by this object.

 

示例

示例 1: The following script sends mail to vpg and gwp, copying jaym, with the specified subject and body for the message:

 

 

 

属性

<server>
SMName = new SendMail();
SMName.To = "vpg@co1.com, gwp@co2.com"
SMName.From = "me@myco.com"
SMName.Cc = "jaym@hisco.com"
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> 示例 2: The following example sends an image in a GIF file: sm = new SendMail();
sm.To = "satish";
sm.From = "satish@netscape.com";
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(); 示例 3: The following example sends a multipart message: sm = new SendMail();
sm.To = "chandra@cs.uiowa.edu, satish@netscape.com";
sm.From = "satish@netscape.com";
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(); The file 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. Bcc

Comma-delimited list of recipients of the message whose names should not be visible in the message.

属性源

SendMail

实现版本

Netscape Server 3.0

 

Body

Text of the message.

属性源

SendMail

实现版本

Netscape Server 3.0

 

Cc

Comma-delimited list of additional recipients of the message.

属性源

SendMail

实现版本

Netscape Server 3.0

 

Errorsto

Address to which to send errors concerning the message. Defaults to the sender's address.

属性源

SendMail

实现版本

Netscape Server 3.0

 

From

User name of the person sending the message.

属性源

SendMail

实现版本

Netscape Server 3.0

 

Organization

Organization information.

属性源

SendMail

实现版本

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.

属性源

SendMail

实现版本

LiveWire 1.0

 

User name to which replies to the message should be sent. Defaults to the sender's address.

 

 

Mail (SMTP) server name. Defaults to the value specified through the setting in the Administration server.

属性源

SendMail

实现版本

Netscape Server 3.0

 

Subject

Subject of the message.

属性源

SendMail

实现版本

Netscape Server 3.0

 

To

Comma-delimited list of primary recipients of the message.

属性源

SendMail

实现版本

Netscape Server 3.0

 

方法

errorCode

Returns an integer error code associated with sending this message.

方法源

SendMail

实现版本

Netscape Server 3.0

 

语法

public errorCode(); 返回

The possible return values and their meanings are as follows:

0

Successful send.

1

SMTP server not specified.

2

Specified mail server is down or doesn't exist.

3

At least one receiver's address must be specified to send the message.

4

Sender's address must be specified to send the message.

5

Mail connection problem; data not sent.

 

errorMessage

Returns a string associated with sending this message.

方法源

SendMail

实现版本

Netscape Server 3.0

 

语法

public errorMessage(); 返回

An error string.

send

Sends the mail message represented by this object.

方法源

SendMail

实现版本

Netscape Server 3.0

 

语法

public send (); 返回

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. 

Replyto

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值