Jmail程式範例

  • < %
    '在 4.x 版應使用 Jmail.Message 來創造物件
    Set oJmail = Server.CreateObject("Jmail.Message")
    '啟動錯誤紀錄
    oJmail.Logging = True
    oJmail.Silent = True
    '如果你使用繁體中文, 應該設定字集為 big5
    oJmail.Charset = "big5"
    oJmail.ContentType = "text/html"
    '如果你的郵件主旨會出現亂碼, 可將 ISOEncodeHeaders 設為 False oJmail.ISOEncodeHeaders = False
    '設定寄件人
    oJmail.From = "寄件者email"
    oJmail.FromName = "JMail 測試"
    '設定收件人, 收件人姓名參數是可以省略的
    oJmail.AddRecipient "收件者email", "測試"
    oJmail.Subject = "利用 Jmail 寄 Email"
    oJmail.HTMLBody = "這是利用 Jmail 寄出的測試信..."
    If Not oJmail.Send("localhost") Then
    ? Response.Write oJmail.Log
    Else
    ? Response.Write "郵件已經寄出..."
    End If
    %>

CDO程式範例

  • < %
    Set objEmail = CreateObject("CDO.Message")
    objEmail.Configuration.Fields.Item
    ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objEmail.Configuration.Fields.Item
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver")
    ="localhost"
    objEmail.Configuration.Fields.Item
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 objEmail.Configuration.Fields.Update
    objEmail.From = "寄件者email" '寄信者信箱
    objEmail.To = "收件者email"? ? '收信者信箱
    objEmail.Subject = "信件標題"
    objEmail.HTMLbody = " HTML信件內文"?
    objEmail.Send
    set objEmail=nothing
    response.write "信件已經成功寄出"?? '寄送完成畫面訊息
    %>

Cdonts程式範例

  • < %
    dim strHTML_Body
    strHTML_Body = ""
    strHTML_Body = ""
    strHTML_Body = strHTML_Body &
    strHTML_Body = strHTML_Body & "這是一封由CDONTS物件寄出的測試信件
    strHTML_Body = strHTML_Body &
    strHTML_Body = strHTML_Body &
    Set ObjSendMail=server.CreateObject("CDONTS.NewMail")
    ObjSendMail.BodyFormat=0
    ObjSendMail.MailFormat=0
    ObjSendMail.From = "寄件者email" '寄信者信箱
    ObjSendMail.to = "收件者email" '收信者信箱
    ObjSendMail.subject = "CDONTS寄信測試"
    ObjSendMail.body = strHTML_Body
    ObjSendMail.Send
    Set ObjSendMail=Nothing
    %>

AspSmartUpload程式範例

  • < %
    'Variables
    Dim mySmartUpload
    Dim intCount
    'Object creation
    Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
    'Upload
    mySmartUpload.Upload
    'Save the files with their original names in a virtual path of the web server
    intCount = mySmartUpload.Save("/aspsmartupload/upload")
    ' sample with a physical path
    ' intCount = mySmartUpload.Save("c:\temp\")
    'Display the number of files uploaded
    Response.Write(intCount & " file(s) uploaded.")
    %>

LytUpload程式範例

  • < %
    filepath=Server.MapPath("/upload_test")
    Set obj = Server.CreateObject("LyfUpload.UploadFile")
    txt = obj.request("text1")
    Response.Write( "文本框1的輸入值是: " & txt)
    Response.Write "
    "
    ss=obj.SaveFile("file1", filepath,true)
    'ss=obj.SaveFile("file1", "c:\temp",true)
    aa=obj.filetype("file1")
    if ss<> "" then
    Response.Write "選擇的文件已經上載到服務器!
    "
    Response.Write("文件名:" & ss)
    Response.Write("
    Content- Type:" & aa)
    end if
    obj.about
    %>