zoukankan      html  css  js  c++  java
  • ASP Send email

    CDOSYS is a built-in component in ASP. This component is used to send e-mails with ASP.
    CDOSYS是嵌套在ASP中的一个组件。这个ASP组件的作用是发送电子邮件的。

    --------------------------------------------------------------------------------

    Sending e-mail with CDOSYS
    使用CDOSYS发送电子邮件

    CDO (Collaboration Data Objects) is a Microsoft technology that is designed to simplify the creation of messaging applications.
    CDO(Collaboration Data Object:协同操作数据对象)是微软开发的一种技术,它的作用是创建简单的信息应用程序。

    CDOSYS is a built-in component in ASP. We will show you how to use this component to send e-mail with ASP.
    CDOSYS是ASP当中的一个组建。我们将会告诉你如何使用这个组件来发送电子邮件。

    How about CDONTs?
    什么是CDONTs?

    Microsoft has discontinued the use of CDONTs on Windows 2000, Windows XP and Windows 2003. If you have used CDONTs in your ASP applications, you should update the code and use the new CDO technology.
    微软已经在Windows2000、WindowsXP以及Windows2003中不再使用CDONTs技术了。如果你已经在ASP应用程序中使用了CDONTs技术,你必须先升级代码从而使用最新的CDO技术。

    Examples using CDOSYS
    CDOSYS案例分析:
    Sending a text e-mail:
    发送一个文本格式的E-mail: 

    代码
    <%
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject
    ="Sending email with CDO"
    myMail.From
    ="mymail@mydomain.com"
    myMail.To
    ="someone@somedomain.com"

    myMail.TextBody
    ="This is a message."
    myMail.Send
    set myMail=nothing
    %
    > 

    Sending a text e-mail with Bcc and CC fields:
    发送带有BCC和CC域文件的电子邮件文本: 

    代码
    <%
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject
    ="Sending email with CDO"
    myMail.From
    ="mymail@mydomain.com"
    myMail.To
    ="someone@somedomain.com"
    myMail.Bcc
    ="someoneelse@somedomain.com"
    myMail.Cc
    ="someoneelse2@somedomain.com"

    myMail.TextBody
    ="This is a message."
    myMail.Send
    set myMail=nothing
    %
    > 

    Sending an HTML e-mail:
    发送一个HTML格式的电子邮件 

    代码
    <%
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject
    ="Sending email with CDO"
    myMail.From
    ="mymail@mydomain.com"
    myMail.To
    ="someone@somedomain.com"
    myMail.HTMLBody 
    = "<h1>This is a message.</h1>" 

    myMail.Send
    set myMail=nothing
    %
    > 

    Sending an HTML e-mail that sends a webpage from a website:
    发送网站上的页面

    代码
    <%
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject
    ="Sending email with CDO"

    myMail.From
    ="mymail@mydomain.com"
    myMail.To
    ="someone@somedomain.com"
    myMail.CreateMHTMLBody 
    "http://www.w3schools.com/asp/" 
    myMail.Send
    set myMail=nothing
    %
    > 

    Sending an HTML e-mail that sends a webpage from a file on your computer:
    发送来自本地计算机上的HTML格式文件: 

    代码
    <%
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject
    ="Sending email with CDO"
    myMail.From
    ="mymail@mydomain.com"
    myMail.To
    ="someone@somedomain.com"

    myMail.CreateMHTMLBody 
    "http://www.cnblogs.com/qiangshu/admin/file:///c:/mydocuments/test.htm" 
    myMail.Send
    set myMail=nothing
    %
    > 

    Sending a text e-mail with an Attachment:
    发送一个带有附件的电子邮件文本: 

    代码
    <%
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject
    ="Sending email with CDO"
    myMail.From
    ="mymail@mydomain.com"
    myMail.To
    ="someone@somedomain.com"
    myMail.TextBody
    ="This is a message."
    myMail.AddAttachment 
    "c:mydocumentstest.txt"

    myMail.Send
    set myMail=nothing
    %
    > 

    Sending a text e-mail using a remote server:
    使用远程服务器发送文本格式的电子邮件

    代码
    <%
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject
    ="Sending email with CDO"

    myMail.From
    ="mymail@mydomain.com"
    myMail.To
    ="someone@somedomain.com"
    myMail.TextBody
    ="This is a message."
    myMail.Configuration.Fields.Item _
    (
    "http://schemas.microsoft.com/cdo/configuration/sendusing%22)=2
    'Name or IP of remote SMTP server
    myMail.Configuration.Fields.Item _
    (
    "http://schemas.microsoft.com/cdo/configuration/smtpserver") _
    ="smtp.server.com"
    'Server port
    myMail.Configuration.Fields.Item _
    (
    "http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
    =25 
    myMail.Configuration.Fields.Update
    myMail.Send
    set myMail=nothing
    %
    > 
  • 相关阅读:
    asp.NET中,密码输入框一刷新后输入的密码就清空,但刷新后保留刷新前输入的密码怎么做?
    js 调用C#.NET后台方法 转载自:http://www.cnblogs.com/lizhao/archive/2010/11/23/1990436.html
    Oracle Class8. 子程序和程序包 全新时代
    Oracle Class6. PL/SQL 简介(数据类型,逻辑比较,控制结构,错误处理) 全新时代
    Oracle Class5. Oracle 中的 OOP 概念(ordbms与rdbms比较,oracle中的对象) 全新时代
    Oracle Class4. 数据库对象(同义词,序列,视图,索引,簇) 全新时代
    Oracle Class9. 数据库触发器和内置程序包 全新时代
    Oracle Class61. PL/SQL 简介(数据类型,逻辑比较,控制结构,错误处理) 全新时代
    Oracle Class3. 锁和表分区 全新时代
    Oracle Class2. SQL查询和SQL函数(Oracle数据类型,ddl,dml,dcl,事务控制语言tcl,sql操作符,sql函数,select语句,运算符,分析函数,临时表) 全新时代
  • 原文地址:https://www.cnblogs.com/qiangshu/p/1629829.html
Copyright © 2011-2022 走看看