组件使用方法:
set oVar=Server.CreateOject(“jmail.smtpmail”)编号 | 属性名 | 类型 | 版本 | 用途 | 使用举例 |
1 | Body | String | v3.0 | 信件体,正文,使用AppendText追加内容 | JMail.Body = "Hello world" |
2 | Charset | String | v3.0 | 字符集,缺省为"US-ASCII" 简体中文是gb2312 | Jmail.Charset = "US-ASCII" |
3 | ContentTransferEncoding | String | v3.0 | 指定内容传送时的编码方式,缺省是"Quoted-Printable"(例如ChinaASP=C2=DB=CC=B3 代表ChinaASP论坛,等于号后面的是gb码的16进制代码) | Jmail.ContentTransferEncoding = "base64" |
4 | ContentType | String | v3.0 | 信件的contentype. 缺省是"text/plain",但是可以设置为其他你想要的类型。如果你以HTML格式发送邮件, 改为"text/html"即可。 | JMail.C |
5 | DeferredDelivery | Date | v3.0 | 设置延期发送. 如果邮件服务器支持的话,消息到了这个时间才会发送 | (Javascript)Jmail.DeferredDelivery = new Date( 2000, 02, 17 ).getVarDate(); |
6 | Encoding | String | v3.0 | 这个属性可以用来改变附件编码方式(缺省是"base64). 可以选择使用的是"base64", "uuencode" or "quoted-printable" | JMail.Encoding = "base64" |
7 | ErrorCode | Integer | v3.0 | 如果JMail.silent设置为true,ErrorCode包含的是错误代码 | Response.Write( JMail.ErrorCode ); |
8 | ErrorMessage | String | v3.0 | 如果JMail.silent设置为true,包含的是错误信息 | Response.Write( JMail.ErrorMessage ); |
9 | ErrorSource | String | v3.0 | 如果JMail.silent设置为true,包含的是错误的来源 | Response.Write( JMail.ErrorSource ); |
10 | ISOEncodeHeaders | String | v3.0 | 是否将信头编码成iso-8859-1字符集. 缺省是true | JMail.ISOEncodeHeaders = false |
11 | Lazysend | Boolean | v3.0 | 这个属性指定Jmail是否一直等到mail发送了然后返回,或者缓冲这条消息然后在后台发送。然而设置了这个属性,你就不能控制错误信息。 注意:如果选择了这个选项,属性ServerAddress将无效,lazysend将通过dsn查询决定邮件服务器, 在一些设置里面,这可能有问题。 | JMail.LazySend = true; |
12 | Log | String | v3.0 | Jmail创建的日志,如果loging属性设置为true | Response.Write( JMail.Log ); |
13 | Logging | String | v3.0 | 是否使用日志 | JMail.Logging = true |
14 | MailDomain | String | v3.0 | 改写发送到邮件服务器的EHLO/HELO命令 | JMail.Maildomain = "hello.world.com" |
15 | MimeVersion | String | v3.0 | 指定mime版本。缺省是"1.0" | JMail.MimeVersion = "1.0" |
16 | Priority | Integer | v3.0 | 优先级. 范围在1-5之间 1 高优先级. 有些邮件程序称之为紧急 2 也是高优先级 3 普通优先级 4 低优先级 5 最低的优先级 | Jmail.Priority = 3 |
17 | Recipients | String | v3.0 | 只读属性,返回所有收件人 | Response.Write( "" + JMail.Recipients + "" ); |
18 | ReplyTo | String | v3.0 | 指定一个可选的回信地址 | Jmail.ReplyTo = "president@dimac.net" |
19 | ReturnReceipt | Boolean | v3.0 | 指定是否发件人需要一个回复收据. 缺省是false | Jmail.ReturnReceipt = true |
20 | Sender | String | v3.0 | 指定发件人的邮件地址 | Jmail.Sender = "batman@dimac.net" |
21 | SenderName | String | v3.0 | 指定发件人的姓名 | Jmail.SenderName = "Bat man" |
22 | ServerAddress | String | v3.0 | 指定邮件服务器的地址。可以指定多个服务器,用分号点开。可以指定端口号。 如果serverAddress保持空白,Jmail会尝试解决远程邮件服务器,然后直接发送到服务器上去。 | Jmail.ServerAddress = "mail.mydom.net; mail2.mydom.net:2500" |
23 | Silent | Boolean | v3.0 | 如果设置为true,JMail不会抛出例外错误. JMail.execute() 会根据操作结果返回true或false | Jmail.silent = true |
24 | SimpleLayout | Boolean | v3.0 | 设置为true,减少Jmail产生的header信头 | Jmail.SimpleLayout = true |
25 | Subject | String | v3.0 | 设定消息的标题 | Jmail.Subject = "Dimac rocks big time!" |
26 | UsePipelining | Boolean | v3.0 | Overrides if Jmail should use pipelining on a server that supports it. | Jmail.Pipelining = false |
编号 | 方法 | 版本 | 用途 | 使用举例 |
1 | AddAttachment( FileName, [ContentType] ) | v30 | 添加文件附件到信件 | JMail.AddAttachment( "c:\\autoexec.bat" ); |
2 | AddCustomAttachment( FileName, Data ) | v3.0 | 添加自定义附件. This can be used to attach "virtual files" like a generated text string or certificate etc. | JMail.AddCustomAttachment( "readme.txt", "Contents of file" ); |
3 | AddHeader( XHeader, Value ) | v3.0 | 添加用户定义的X-header到message | JMail.AddHeader( "Originating-IP","193.15.14.623" ); |
4 | AddNativeHeader( Header, Value ) | v3.0 | 添加信头 | JMail.AddNativeHeader( "MTA-Settings", "route" ); |
5 | AddRecipient( Email ) | v3.0 | 增加收件人 | JMail.AddRecipient( "info@dimac.net" ); |
6 | AddRecipientBCC( Email ) | v3.0 | 增加密送收件人 | JMail.AddRecipientBCC( "someone@somedomain.net" ); |
7 | AddRecipientCC( Email ) | v3.0 | 增加抄送收件人 | JMail.AddRecipientCC( "someone@somedomain.net" ); |
8 | AddRecipientEx( Email, Name ) | v3.0 | 增加一个带名字的收件人 | JMail.AddRecipientEx( "info@dimac.net", "Dimac INFO" ); |
9 | AddURLAttachment( bstrURL, bstrAttachAs, [bstrAuth] ) | v3.0 | 下载并添加一个来自url的附件. 第二个参数"AttachAs", 被用来指定信件收到后的文件名. 第3个可选参数是用来可选的WWW-鉴定. | JMail.AddURLAttachment( "http://download.dimac.net/jmail/jmail.exe", "jmail.exe" ) |
10 | AppendBodyFromFile( FileName ) | v3.0 | 将一个文件内容追加到正文后 | JMail.AppendBodyFromFile( "c:\\mytext.txt" ); |
11 | AppendText( Text ) | v3.0 | 追加信件的正文内容 | JMail.AppendText( "Text appended to message Body" ); |
12 | ClearAttachments() | v3.0 | 清除附件列表 | JMail.ClearAttachments(); |
13 | ClearCustomHeaders() | v3.0 | 清除所有自定义的信头 | JMail.ClearCustomHeaders(); |
14 | ClearRecipients() | v3.0 | 清除收件人列表 | JMail.Close(); |
15 | Execute() :Boolean | v3.0 | 执行邮件的发送 | JMail.Execute(); |
16 | ExtractEmailAddressesFromURL( bstrURL, [bstrAuth] ) | v3.0 | 从一个url下载和添加email地址 | JMail.ExtractEmailAddressesFromURL( "http://duplo.org/generateEmailList.asp" ); |
17 | GetMessageBodyFromURL( bstrURL, [bstrAuth] ) | v3.0 | 清除message的正文,并用url的内容替换。Contenttype 会自动设置成URl的contentyp。第二参数(login and password)是可选的。 | JMail.GetMessageBodyFromURL( "http://duplo.org/", "login:password" ) |
18 | LogCustomMessage( Message ) | v3.0 | 将用户自定义消息加入Jmail日志. 只有属性loging设置为true时,这项功能才能起作用 | JMail.LogCustomMessage( "Hello world" ); |