W3 Jmail 简要介绍
2000-09-15·飞鸟·china asp
『简要介绍』
主页:http://tech.dimac.net/
使用w3 JMail 可以在asp应用里面发送电子邮件,而不需要使用一个诸如Eudora/exchange/outlook
之类的邮件客户端。w3 Jmail发送邮件速度快,功能丰富,而且是免费的,可以直接下载。
下载地址:http://download.dimac.net/jmail/jmail.exe
使用环境
Webserver (IIS4/PWS4)
Microsoft Windows NT or Microsoft Windows 95 with Winsock 2.0 (Downloadfrom Microsoft)
版本3.60的特性
Attachments 附件
Return Receipt 发信回执
Detailed logging capabilities 详细日志能力
Priority settings 优先级设定
MIME with BASE64, UUEncode and Quoted-Printable Encoding 邮件编码设置
Queued mailings without separate NT service. 邮件队列发送,无需单独的NT服务
Unlimited redundant servers 没有限制的多余server(SMTP服务器)
Blind Carbon Copy (BCC) 密送
Carbon Copy (CC) 抄送
Urgent flagging 紧急标志
US ASCII and ISO-8859-1
UUEncoding
X-Headers and custom headers
MS Mail and Exchange priority headers.
Internal MX lookup with MX priority and redundancy
JMAIL的日志功能允许你能察看发送邮件时候发生的事情,这是一种发现问题所在的好方法,
如果MAIL SERVER错误设置的话。
JMail 已经检查了下列Y2K测试
2000-01-01 Bug - OK
2000-02-29 Bug - OK
2000-04-01 Bug - OK (Found in MS VCRT)
JMAIL使用16位精度表示年,所以日期范围限制在 -32767~ 32768
W3 Jmail 参考说明
2000-09-15·飞鸟·china asp
jmail.smtpmail
Body : String
(v3.0)
信件体,正文,使用AppendText追加内容
如:JMail.Body = "Hello world"
Charset : String
(v3.0)
字符集,缺省为"US-ASCII"
如:JMail.Charset = "US-ASCII"
ContentTransferEncoding : String
(v3.0)
指定内容传送时的编码方式,缺省是"Quoted-Printable"
如:JMail.ContentTransferEncoding = "base64"
ContentType : String
(v3.0)
信件的contentype. 缺省是"text/plain",但是可以设置为其他你想要的类型.
如果你以HTML格式发送邮件, 改为"text/html"即可。
如:JMail.ContentType = "text/html"
DeferredDelivery : Date
(v3.0)
设置延期发送. 如果邮件服务器支持的话,消息到了这个时间才会发送
如:(javascript)JMail.DeferredDelivery = new Date( 2000, 02, 17 ).getVarDate();
Encoding : String
(v3.0)
这个属性可以用来改变附件编码方式(缺省是"base64). 可以选择使用的是"base64", "uuencode" or "quoted-printable"
如:JMail.Encoding = "base64"
ErrorCode : Integer
(v3.0)
如果JMail.silent设置为true,ErrorCode包含的是错误代码
如:Response.Write( JMail.ErrorCode );
ErrorMessage : String
(v3.0)
如果JMail.silent设置为true,包含的是错误信息
如:Response.Write( JMail.ErrorMessage );
ErrorSource : String
(v3.0)
Contains the error source if JMail.silent is set to true
如:Response.Write( JMail.ErrorSource );
ISOEncodeHeaders : Boolean
(v3.0)
是否将信头编码成iso-8859-1字符集. 缺省是true
如:JMail.ISOEncodeHeaders = false
Lazysend : Boolean
(v3.0)
这个属性指定Jmail是否一直等到mail发送了然后返回,或者缓冲这条消息然后在后台发送。然而设置了这个属性,你就不能控制错误信息。
注意:如果选择了这个选项,属性ServerAddress将无效,lazysend将通过dsn查询决定邮件服务器,在一些设置里面,这可能有问题。
如:JMail.LazySend = true;
Log : String
(v3.0)
Jmail创建的日志,如果loging属性设置为true
如:Response.Write( JMail.Log );
Logging : Boolean
(v3.0)
是否使用日志
如:JMail.Logging = true
MailDomain : String
(v3.0)
This can be used to override the EHLO/HELO statement to your mailserver
如:JMail.Maildomain = "hello.world.com"
MimeVersion : String
(v3.0)
指定mime版本。缺省是"1.0"
如:JMail.MimeVersion = "1.0"
Priority : Integer
(v3.0)
优先级. 范围在1-5之间
1 高优先级. 有些邮件程序称之为紧急
2 也是高优先级
3 普通优先级
4 低优先级
5 最低的优先级
如:JMail.Priority = 3
Recipients : String
(v3.0)
只读属性,返回所有收件人
如:Response.Write( "" + JMail.Recipients + "" );
ReplyTo : String
(v3.0)
指定一个可选的回信地址
如:JMail.ReplyTo = "president@dimac.net"
ReturnReceipt : Boolean
(v3.0)
指定是否发件人需要一个回复收据. 缺省是false
如:JMail.ReturnReceipt = true
Sender : String
(v3.0)
指定发件人的邮件地址
如:JMail.Sender = "batman@dimac.net"
SenderName : String
(v3.0)
指定发件人的姓名
如:JMail.SenderName = "Bat man"
ServerAddress : String
(v3.0)
指定邮件服务器的地址。可以指定多个服务器,用分号点开。可以指定端口号。如果serverAddress保持空白,JMail会尝试解决远程邮件服务器,然后直接发送到服务器上去。
如:JMail.ServerAddress = "mail.mydom.net; mail2.mydom.net:2500"
Silent : Boolean
(v3.0)
如果设置为true,JMail不会抛出例外错误. JMail.execute() 会根据操作结果返回true或false
如:JMail.silent = true
SimpleLayout : Boolean
(v3.0)
设置为true,减少Jmail产生的header信头
如:JMail.SimpleLayout = true
Subject : String
(v3.0)
设定消息的标题
如:JMail.Subject = "Dimac rocks big time!"
UsePipelining : Boolean
(v3.0)
Overrides if JMail should use pipelining on a server that supports it.
如:JMail.Pipelining = false
AddAttachment( FileName, [ContentType] )
(v3.0)
添加文件附件到信件
如:JMail.AddAttachment( "c:\\autoexec.bat" );
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" );
AddHeader( XHeader, value )
(v3.0)
添加用户定义的X-header到message
如:JMail.AddHeader( "Originating-IP","193.15.14.623" );
AddNativeHeader( Header, value )
(v3.0)
添加信头
如:JMail.AddNativeHeader( "MTA-Settings", "route" );
AddRecipient( Email )
(v3.0)
增加收件人
如:JMail.AddRecipient( "info@dimac.net" );
AddRecipientBCC( Email )
(v3.0)
增加密件收件人
如:JMail.AddRecipientBCC( "someone@somedomain.net" );
AddRecipientCC( Email )
(v3.0)
增加抄送收件人
如:JMail.AddRecipientCC( "someone@somedomain.net" );
AddRecipientEx( Email, Name )
(v3.0)
增加一个带名字的收件人
如:JMail.AddRecipientEx( "info@dimac.net", "Dimac INFO" );
AddURLAttachment( bstrURL, bstrAttachAs, [bstrAuth] )
(v3.0)
下载并添加一个来自url的附件. 第二个参数"AttachAs", 被用来指定信件收到后的文件名. 第3个可选参数是用来可选的WWW-鉴定.
如:JMail.AddURLAttachment( "http://download.dimac.net/jmail/jmail.exe", "jmail.exe" )
AppendBodyFromFile( FileName )
(v3.0)
将一个文件内容追加到正文后
如:JMail.AppendBodyFromFile( "c:\\mytext.txt" );
AppendText( Text )
(v3.0)
追加信件的正文内容
如:JMail.AppendText( "Text appended to message Body" );
ClearAttachments()
(v3.0)
清除附件列表
如:JMail.ClearAttachments();
ClearCustomHeaders()
(v3.0)
清除所有自定义的信头
如:JMail.ClearCustomHeaders();
ClearRecipients()
(v3.0)
清除收件人列表
如:JMail.ClearRecipients();
Close()
(v3.0)
强制JMail关闭缓冲的与邮件服务器的连接
如:JMail.Close();
Execute() : Boolean
(v3.0)
执行邮件的发送
如:JMail.Execute();
ExtractEmailAddressesFromURL( bstrURL, [bstrAuth] )
(v3.0)
从一个url下载和添加email地址
如:JMail.ExtractEmailAddressesFromURL( "http://duplo.org/generateEmailList.asp" );
GetMessageBodyFromURL( bstrURL, [bstrAuth] )
(v3.0)
清除message的正文,并用url的内容替换。Contenttype 会自动设置成URl的contentyp。第二参数(login and password)是可选的。
如:JMail.GetMessageBodyFromURL( "http://duplo.org/", "login:password" )
LogCustomMessage( Message )
(v3.0)
将用户自定义消息加入JMail日志. 只有属性loging设置为true时,这项功能才能起作用
如:JMail.LogCustomMessage( "Hello world" );
W3 Jmail 使用范例
2000-09-15·飞鸟·china asp
『使用范例』
<html>
<head>
<title>Confirmation </title>
<body>
<%
Set JMail = Server.CreateObject("JMail.SMTPMail")
' This is my local SMTP server
JMail.ServerAddress = "mail.yourdomain.com:25"
' This is me....
JMail.Sender = "myemail@mydomain.net"
JMail.Subject = "Here you go..."
' Get the recipients mailbox from a form (note the lack of a equal sign).
JMail.AddRecipient "mum@any.com"
JMail.AddRecipient "dad@some.com"
' The body property is both read and write.
' If you want to append text to the body you can
' use JMail.Body = JMail.Body & "Hello world!"
' or you can use JMail.AppendText "Hello World!"
' which in many cases is easier to use.
JMail.Body = "Here you go. Your request has been approved" &_
"and the program is attached to this message"
' 1 - highest priority (Urgent)
' 3 - normal
' 5 - lowest
JMail.Priority = 1
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
' Must make sure that IUSR_???? has access to the following files.
JMail.AppendBodyFromFile "e:\mail\standard_footer.txt"
JMail.AddAttachment "e:\products\MyProduct.exe"
' Send it...
JMail.Execute
%>
<center>
An e-mail has been sent to your mailbox (<%=request.form("email")%>).
</center>
</body>
</html>
