我有一个在 WinXP 机器(IIS 5.1)上开发和单元测试的 web 应用程序项目。它已发布到 Win2003Server (IIS 6.0)。该应用程序的一项功能会发送一封带有“回复”标题的电子邮件(以下是片段)。在 IIS 5.1 机器上,Reply-To 正确显示在标题中。从 IIS 6.0 PC 发送时,标头不包含回复地址(见下文):
Public Shared Sub SendEmail_withReplyTo(ByVal emailfrom As String, _
ByVal emailto As String, _
ByVal vbody As String, _
ByVal vsubject As String, _
ByVal msgcc As String, _
ByVal msgbcc As String, _
ByVal sReplyTo As String)
Dim MyMsg As New MailMessage
ErrorTrap.ErrorMsg = Nothing
With MyMsg
.From = New MailAddress(emailfrom)
.Headers.Add("Reply-To", sReplyTo)
.To.Add(emailto)
If msgcc.Length > 0 Then
.CC.Add(msgcc)
End If
If msgbcc.Length > 0 Then
.Bcc.Add(msgbcc)
End If
.Subject = vsubject
.IsBodyHtml = True
.Body = vbody
End With
Try
Dim smtp As New SmtpClient
smtp.Send(MyMsg)
Catch ex As Exception
ErrorTrap.ErrorMsg = Nothing
ErrorTrap.ErrorMsg = ex.ToString
End Try
End Sub
以下Internet 标题是从 MS Outlook 2003 - 查看 - 选项粘贴的:
从 JOHNXP 机器(带有 IIS 5.1 的开发 PC)发送的有效回复:
Return-path: <Service@zipeee.com>
Received: from JohnXP (unverified [10.10.30.66]) by mail.cbmiweb.com
(Rockliffe SMTPRA 9.2.0) with ESMTP id <B0003406093@mail.cbmiweb.com>;
Mon, 28 Jun 2010 15:16:25 -0400
Message-ID: <B0003406093@mail.cbmiweb.com>
Reply-To: terriadams@cox.net
MIME-Version: 1.0
From: Service@ZIPeee.com
To: johna@cbmiweb.com
Date: 28 Jun 2010 15:17:57 -0400
Subject: Regarding your Ad #153949: Yard sale in vienna va June 12 at 8am
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
缺少从 MOJITO 机器(带有 IIS 6.0 的 2003 服务器)发送的回复:
Return-path: <Service@zipeee.com>
Received: from MOJITO (unverified [10.10.30.14]) by mail.cbmiweb.com
(Rockliffe SMTPRA 9.2.0) with ESMTP id <B0003405883@mail.cbmiweb.com>;
Mon, 28 Jun 2010 13:37:53 -0400
Message-ID: <B0003405883@mail.cbmiweb.com>
MIME-Version: 1.0
From: Service@ZIPeee.com
To: johna@cbmiweb.com
Date: 28 Jun 2010 13:39:25 -0400
Subject: Regarding your Ad #153949: Yard sale in vienna va June 12 at 8am
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
我什至在 Win2003 机器上设置了 VStudio2008 并在上面代码中的断点处停止,以确保邮件实际上是正确构建的,并在标题中添加了“回复”(确实如此)。然而,当到达 Outlook 时,来自 MOJITO 服务器的邮件在标题中缺少“回复”。
是否还有其他配置问题会阻碍实际代码尝试执行的操作?