向电子邮件 VB ASP 3.0 脚本添加额外的标题 [英] Add extra header to email VB ASP 3.0 script

查看:19
本文介绍了向电子邮件 VB ASP 3.0 脚本添加额外的标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 VB ASP 3.0 中的 Web 应用程序.我有以下代码来发送电子邮件:

I'm working with a web app in VB ASP 3.0. I have the following code to send an email:

    Const cdoSendUsingMethod        = _
            "http://schemas.microsoft.com/cdo/configuration/sendusing"
    Const cdoSendUsingPort          = 2
    Const cdoSMTPServer             = _
            "http://schemas.microsoft.com/cdo/configuration/smtpserver"
    Const cdoSMTPServerPort         = _
            "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
    Const cdoSMTPConnectionTimeout  = _
            "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
    Const cdoSMTPAuthenticate       = _
            "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
    Const cdoBasic                  = 1
    Const cdoSendUserName           = _
            "http://schemas.microsoft.com/cdo/configuration/sendusername"
    Const cdoSendPassword           = _
            "http://schemas.microsoft.com/cdo/configuration/sendpassword"

    Set objMessage = CreateObject("CDO.Message")
        objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2 
        objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1 
        objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername")="xxxxxxx"
        objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword")="xxxxxxx" 
        objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl")=false 
        objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.socketlabs.com"

        objMessage.Configuration.Fields.Update 

    fFromEmail = "xxx@xxx.com"
    fFromAlias = "Display name"
    fReplyTo = "xxx@xxx.com"
    if isObject(objMessage) then
        With objMessage
            .To       = fToEmail
            .Cc      = fCCEmail
            .Bcc      = fBCCEmail
            .From     = fFromAlias & "<" & fFromEmail & ">"
            .Subject  = fSubject
            .HTMLBody = fEmailBody
            .Send
        End With

        SendEmail = summaryEmailBody
        Set objMessage = Nothing
    End If

此脚本有效,但现在我需要添加一个额外的标题.但是当我不在 .net 框架中时,我找不到如何做到这一点.

This script works, but now I need to add an extra header. But I can't find how to do so when not in a .net framework.

我尝试添加以下行:

        objMessage.Configuration.Fields.Item("urn:schemas:mailheader:X-xsMailingId") = "clientName"

但是没有用.任何帮助将不胜感激.

but it didn't work. Any help will be greatly appreciated.

推荐答案

您需要将标题添加到 objMessage.Fields 集合而不是 objMessage.Configuration.Fields根据官方文档(见 VBScript 部分)

You need to add the header into the objMessage.Fields collection instead of objMessage.Configuration.Fields according to official documentation (see VBScript section)

objMessage.Fields.Item("urn:schemas:mailheader:X-xsMailingId") = "clientName"
objMessage.Fields.Update

那么它应该可以工作了.

Then it should work.

这篇关于向电子邮件 VB ASP 3.0 脚本添加额外的标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆