Setting the Reply-To 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 
复制代码

 

 

posted @   ®Geovin Du Dream Park™  阅读(455)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!
< 2010年1月 >
27 28 29 30 31 1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31 1 2 3 4 5 6
点击右上角即可分享
微信分享提示