zoukankan      html  css  js  c++  java
  • Setting the ReplyTo Header in an Email using CDONTS.NewMail Object and CDO Message

    代码
     1 <%
     2 Option Explicit
     3 
     4 Dim objMail
     5 Dim strSubject
     6 Dim strBody
     7 
     8 strSubject = "This is a test email"
     9 strBody    = "This test email is using test@devasp.com " & _
    10            " as the sender email address but we are " & _
    11            " using someone@devasp.com as the Reply-To header."
    12 
    13      
    14 ' First create an instance of NewMail Object
    15 Set objMail = Server.CreateObject("CDONTS.NewMail")
    16 
    17 ' Please replace the "From" and "To" email addresses with your 
    18 ' own valid email address. I recieve too many emails 
    19 ' from people who test this sample and keep sending 
    20 ' emails to test@devasp.com, or they keep the "From" property
    21 ' as webmaster@devasp.com and I get response of 
    22 ' undeliverable emails.
    23 ' NOTE: If the "To" or "From" properties of CDONTS contain 
    24 ' invalid email address you will not recieve the email.
    25  
    26 objMail.From = "test@dupcit.com"
    27 objMail.To   = "webmaster@dusystem.com"
    28 
    29 ' Use the value property of the CDONTS.NewMail Object
    30 ' to Set the Reply-To header
    31 
    32 objMail.Value("Reply-To"= "someone@dusystem.com" '回复邮件地址
    33 
    34 objMail.Subject = strSubject
    35 objMail.Body    = strBody
    36 
    37 objMail.Send
    38 
    39 Set objMail = Nothing
    40 %>
    41 
    42 
    43  
    44 
    45 <
    46 
    47 strText = "Test" 
    48 
    49 Const cdoSendUsingPort = 2 
    50 
    51 Const strSmartHost = "myLocalSMTPHost" 
    52 
    53 Set myMail = CreateObject("CDO.Message"
    54 
    55 Set iConf = myMail.Configuration 
    56 
    57 With iConf.Fields 
    58 
    59 .item("http://schemas.microsoft.com/cdo/configuration/sendusing"= cdoSendUsingPort 
    60 
    61 .item("http://schemas.microsoft.com/cdo/configuration/smtpserver"= strSmartHost 
    62 
    63 .Update 
    64 
    65 End With 
    66 
    67 With iConf.Fields 
    68 
    69 .item("http://schemas.microsoft.com/cdo/configuration/sendusing"= cdoSendUsingPort 
    70 
    71 .item("http://schemas.microsoft.com/cdo/configuration/smtpserver"= strSmartHost 
    72 
    73 .Update 
    74 
    75 End With 
    76 
    77 With myMail 
    78 
    79 myMail.From = "geovindu@dupcit.com" 
    80 
    81 myMail.To = "bill@dupcit.com" 
    82 
    83 myMail.ReplyTo = "bill@dusystem.com"  '回复邮件地址
    84 
    85 myMail.Subject = "Internet Communication from Me" 
    86 
    87 myMail.HTMLBody = strText 
    88 
    89 myMail.Send 
    90 
    91 End With 
    92 
    93 Set myMail = Nothing 
    94 
    95 %> 
    96 
    97 
  • 相关阅读:
    latin1
    分享:Django博客开发笔记之博客摘要
    分享:RethinkDB 1.3 发布,分布式 JSON 数据库
    分享:RethinkDB 1.3 发布,分布式 JSON 数据库
    分享:RethinkDB 1.3 发布,分布式 JSON 数据库
    网络神采 最专业的网络信息采集系统! 采集软件_网站采集器_采集程序_新闻采集系统_网络信息采集_文章采集
    分享:RethinkDB 1.3 发布,分布式 JSON 数据库
    分享:RethinkDB 1.3 发布,分布式 JSON 数据库
    'module' object has no attribute 'setdefaultencoding'_阿King's blog_百度空间
    QTreeWidget Class Reference
  • 原文地址:https://www.cnblogs.com/geovindu/p/1659308.html
Copyright © 2011-2022 走看看