发信人: qcrsoft(网痞) 
整理人: qcrsoft(2002-02-03 23:01:10), 站内信件
 | 
 
 
作者: 飞鹰   www.ASPCool.com 
 ------------------范例-----------------
    <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 = "[email protected]" 
    JMail.Subject = "Here you go..." 
    
    ' Get the recipients mailbox from a form (note the lack of a equal sign). 
    JMail.AddRecipient "[email protected]" 
    JMail.AddRecipient "[email protected]" 
    
    ' 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> 
 
 ------------------参考-----------------
 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 = "[email protected]" 
    ReturnReceipt : Boolean 
    (v3.0) 
    指定是否发件人需要一个回复收据. 缺省是false 
    如:JMail.ReturnReceipt = true 
    Sender : String 
    (v3.0) 
    指定发件人的邮件地址 
    如:JMail.Sender = "[email protected]" 
    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( "[email protected]" ); 
    AddRecipientBCC( Email ) 
    (v3.0) 
    增加密件收件人 
    如:JMail.AddRecipientBCC( "[email protected]" ); 
    AddRecipientCC( Email ) 
    (v3.0) 
    增加抄送收件人 
    如:JMail.AddRecipientCC( "[email protected]" ); 
    AddRecipientEx( Email, Name ) 
    (v3.0) 
    增加一个带名字的收件人 
    如:JMail.AddRecipientEx( "[email protected]", "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" ); 
  | 
 
 
 |