使用经典ASP,是否可以使用CDO从地址设置SMTP信封?

时间:2011-02-21 01:09:24

标签: asp-classic smtp messaging

我使用经典ASP和CDOSYS对象发送邮件,但是我希望来自地址的信封 - 即,在SMTP期间由MAIL FROM指定的信封 - 设置为与邮件中的From标头地址不同

这样做的目的是实施VERP。例如,我希望SMTP对话类似于:

220 mail.example.com ESMTP
[...]
MAIL FROM: <info+test=example.com@mydomain.test>
250 2.0.0 OK
RCPT TO: <test@example.com>
250 2.0.0 OK
DATA
354 Start mail input; end with <CRLF>.<CRLF>
From: Company1 <info@mydomain.test>
To: test@example.com
[...]

在上面的示例中,信封来自“info+test=example.com@mydomain.test”,但From标头是“info@mydomain.test”。

希望这是有道理的。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

好吧,我弄明白了,然后我就把它弄清楚了,我看到了你想要的命令......

对我之前给你的可怕答案感到抱歉。这样做......它是MAIL FROM:envelope

所需的“SENDER”
Const cdoSendUsingPort = 2
StrSmartHost = "localhost"

set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")

With iConf.Fields 
.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort 
.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost 
.Update 
End With 




With iMsg
Set .Configuration = iConf
.To = "test@example.com"
.Sender = "info+test=example.com@mydomain.test"
.From="Company1 <info@mydomain.test>"
.Subject = "This is a test CDOSYS message (Sent via Port 25)..."
.HTMLBody = strHTML
.Send
End With