【问题标题】:Using classic ASP, is it possible to set the SMTP envelope from address with CDO?使用经典的 ASP,是否可以使用 CDO 从地址设置 SMTP 信封?
【发布时间】:2017-04-11 20:53:02
【问题描述】:

我正在使用带有 CDOSYS 对象的经典 ASP 发送邮件,但我希望信封发件人地址 - 即在 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
[...]

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

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

【问题讨论】:

    标签: asp-classic smtp messaging


    【解决方案1】:

    好的,我想通了,我把它连线了,我看到了你想要的命令......

    对不起,我之前给你的答案很糟糕。这样就可以了...它是您想要的 MAIL FROM 的“发件人”:信封

    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
    

    【讨论】:

    • 我完全误解了你的问题,是的,我的回答是一堆不匹配的想法......就像我打字时大脑中的电线交叉一样。很抱歉……我现在明白你想做什么了……这是一个有趣的问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-25
    • 2012-04-04
    相关资源
    最近更新 更多