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
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
哲学管理(学)人生, 文学艺术生活, 自动(计算机学)物理(学)工作, 生物(学)化学逆境, 历史(学)测绘(学)时间, 经济(学)数学金钱(理财), 心理(学)医学情绪, 诗词美容情感, 美学建筑(学)家园, 解构建构(分析)整合学习, 智商情商(IQ、EQ)运筹(学)生存.---Geovin Du(涂聚文)
分类:
CSharp code
标签:
email
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!