Jmail的主要參數列表和用法

來源:互聯網
上載者:User

(1)Body(信件本文) : 字串
如:JMail.Body = "這裡可以是使用者填寫的表單內容,可以取自From。"
(2)Charset(字元集,預設為"US-ASCII") : 字串
如:JMail.Charset = "US-ASCII"
(3)ContentTransferEncoding : 字串
指定內容傳送時的編碼方式,預設是"Quoted-Printable"
如:JMail.ContentTransferEncoding = "base64"
(4)ContentType(信件的contentype. 預設是"text/plain") : 字串
如果你以HTML格式發送郵件, 改為"text/html"即可。
如:JMail.ContentType = "text/html"
(5)Encoding : 字串
設定附件編碼方式(預設是"base64)。 可以選擇使用的是"base64", "uuencode" or "quoted-printable"
如:JMail.Encoding = "base64"
(6)Log(Jmail建立的日誌,前提loging屬性設定為true,見下面) : 字串
如:使用Response.Write( JMail.Log )語句列出日誌資訊。
(7)Logging(是否使用日誌) : 布爾型
如:JMail.Logging = true
(8)Recipients : 字串
唯讀屬性,返回所有收件者
如:Response.Write( "" + JMail.Recipients + "" );
(9)ReplyTo(指定別的回信地址) : 字串
如:JMail.ReplyTo = "anyother@mailhost.com"
(10)Sender( 寄件者的郵件地址) : 字串
如:JMail.Sender = "sender@mailhost.com"
(11)SenderName(寄件者的姓名) : 字串
如:JMail.SenderName = "一克"
(12)ServerAddress(郵件伺服器的地址) : 字串
你可以指定多個伺服器,用分號點開。可以指定連接埠號碼。
如果serverAddress保持空白,JMail會嘗試遠程郵件伺服器,然後直接發送到伺服器上去。
如:JMail.ServerAddress = "mail.263.net.cn"
(13)Subject(設定郵件的標題,可以取自From。):字串
如:JMail.Subject = "客戶回函表單"
(14)添加檔案附件到郵件
如:JMail.AddAttachment( "c:/anyfile.zip" )
(15)AddCustomAttachment( FileName, Data )
添加自訂附件.
如:JMail.AddCustomAttachment( "anyfile.txt", "Contents of file" );
(16)AddHeader( Header, Value )
添加使用者定義的信件標題。
如:JMail.AddHeader( "Originating-IP","192.168.10.10" );
(17)AddRecipient(收件者):字串
如:JMail.AddRecipient( "info@dimac.net" );
(18)AddRecipientBCC( Email ),密件收件者:
如:JMail.AddRecipientBCC( "anyone@mailhost.com" );
(19)AddRecipientCC( Email ) ,抄送收件者:
如:JMail.AddRecipientCC( "anyone@mailhost.com" )
(20)AddURLAttachment( URL, 文檔名)
下載並添加一個來自url的附件. 第二個參數"文檔名", 用來指定信件收到後的檔案名稱。
如:JMail.AddURLAttachment( "http://www.chinabs.net/jmail.zip", "jmail" )
(21)AppendBodyFromFile( 檔案名稱) ,將檔案作為信件本文:
如:JMail.AppendBodyFromFile( "c:/anyfile.txt" )
(22)AppendText( Text )
追加信件的本文內容,比如增加問候語或者其它資訊。
如:JMail.AppendText( "歡迎訪問本站!" )
(23)Close() ,強制JMail關閉緩衝的與郵件伺服器的串連:
如:JMail.Close()
(24)Execute() ,執行郵件的發送
如:JMail.Execute() 

下面是忘記密碼時的程式碼:
  path=Server.MapPath("/images/logo.gif")
  Set JMail=Server.CreateObject("JMail.SMTPMail")
  JMail.ContentType="text/html"
  JMail.Encoding = "base64"
  JMail.Charset="gb2312"
  JMail.ServerAddress = "mail.chinabs.net"
  JMail.Sender = "chinabs@chinabs.net"
  JMail.Subject =  "chinabs.net發給您的密碼!"
  JMail.AddRecipient(email)
  JMail.Body =str
  JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
  JMail.AddAttachment(path)
  JMail.Execute
  JMail.Close
  Set JMail = Nothing

  

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.