用ASP發電子郵件 (轉)
用發電子
Dim strTo, strSubject, strBody 'Strings for recipient, subject, boby
Dim objCDO 'The CDO
'First we'll read in the values entered
strTo = Request.Form("to")
'These would read the message subject and body if we let you enter it
'strSubject = Request.Form("subject")
'strBody = Request.Form("body")
strSubject = "Sample sent from X-Bit!"
' This is multi-lined simply for readability
strBody = "This message was sent from a sample at X-Bit. "
strBody = strBody & "It is used to show people how to send e-mail from an "
strBody = strBody & "Active Server Page. If you did not request this "
strBody = strBody & "e-mail yourself, your address was entered by one of "
strBody = strBody & "our visitors. We do not store these e-mail addresses."
strBody = strBody & " Please address all concerns to ."
'Ok we've got the values now on to the point of the script.
'We just check to see if someone has entered anything into the to field.
'If it's equal to nothing we show the form, otherwise we send the message.
'If you were doing this for real you might want to check other fields too
'and do a little entry validation like checking for valid syntax etc.
If strTo = "" Then
%>
Enter your e-mail address:
<!-- These would be used if we decd to let you edit them
Subject:
Message:
-->
Else
' Create an instance of the NewMail object.
Set objCail = Server.CreateObject("CDONTS.NewMail")
' Set the properties of the object
objCDOMail.From = ""
objCDOMail.To = strTo
objCDOMail.Subject = strSubject
objCDOMail.Body = strBody
' There are lots of other properties you can use.
' You can send HTML e-mail, attachments, etc...
' You can also modify most aspects of the message
' like importance, custom headers, ...
' Check the documentation for a full list as well
' as the correct syntax.
' Some of the more useful ones I've included samples of here:
'objCDOMail.Cc = ""
'objCDOMail.Bcc = ""
'objCDOMail.Importance = 1 '(0=Low, 1=Normal, 2=High)
'objCDOMail.AttachFile "c:file.txt", "file.txt"
' Send the message!
objCDOMail.Send
' Set the object to nothing because it immediately becomes
' invalid after calling the Send method.
Set objCDOMail = Nothing
Response.Write "Message sent to " & strTo & "!"
End If
%>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10748419/viewspace-987777/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 直接用通訊錄Excel群發電子郵件(轉)Excel
- 電子郵件
- 用oracle傳送電子郵件Oracle
- 直接用通訊錄Excel群發電子郵件Excel
- Jboss3.0-Tomcat4.03下運用JavaMail發電子郵件. (轉)S3TomcatJavaAI
- 用Visual C++編寫電子郵件程式 (轉)C++
- ASP用JMail、CDO傳送郵件 (轉)AI
- 玩轉展會電子郵件營銷
- 電子郵件“人到中年”
- 60. 電子郵件
- 【陳晨】ASP.NET 2.0中傳送電子郵件ASP.NET
- 用英文寫電子郵件的常用句式
- 如何傳送電子郵件到別人郵箱?電子郵件傳送的方法
- 在VC中呼叫預設的電子郵件程式傳送郵件 (轉)
- ASP.NET2.0傳送電子郵件示例程式碼ASP.NET
- ASP.NET 2.0中傳送電子郵件剖析之一ASP.NET
- ASP.NET 2.0傳送電子郵件全面剖析之二ASP.NET
- 用 C++Builder 編寫傳送電子郵件軟體 (轉)C++UI
- 用ASP實現電子賀卡 (轉)
- 如何用 Linux 命令列發電子郵件Linux命令列
- Shayne Hughes:電子郵件引發效率低下
- 電子郵件協議及GO傳送QQ郵件協議Go
- 在ASP.NET中傳送電子郵件的例項教程ASP.NET
- ASP.NET 2.0傳送電子郵件中存在的問題ASP.NET
- 用 C++BUILDER 實現 POP3 電子郵件的接收 (轉)C++UI
- 電子郵件被黑客追蹤黑客
- 如何保護電子郵件安全
- 安全使用電子郵件十三法
- Postfix電子郵件系統精要
- 救命!我的電子郵件發不到 500 英里以外!
- 純java開發的電子郵件客戶端Java客戶端
- 7種有關電子郵件的錯誤想法 (轉)
- 在.NET框架應用程式中傳送電子郵件框架
- 郵件開發:電子郵件的傳輸過程、各種協議的說明協議
- 共享電子郵件的運作方式
- ADRMS保護電子郵件安全
- 管理電子郵件的7個方法
- 電子郵件管理的COTA法則