0

使用类似下面的内容,是否可以为 DKIM 签名添加标头?从我一直在阅读的内容来看,它看起来不像......为什么不呢?

Dim iMsg, iConf, Flds
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

Set Flds = iConf.Fields

Const cdoSendUsingPort = 2

With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort 
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "server"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic 
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "abc"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "123"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update
End With

With iMsg
Set .Configuration = iConf
.To = recipient
.From = "foo@bar.com"
.Subject = "subject"
.HTMLBody = "body"
.Send
End With
4

1 回答 1

0

如果您已经拥有签名,则可以将其添加到iMsg对象的 Fields 属性中。我之前做过类似的事情来设置“回复”和“回执”地址:

.Fields("urn:schemas:mailheader:disposition-notification-to") = "test@example.com"
.Fields("urn:schemas:mailheader:return-receipt-to") = "test@example.com" 

您可以执行相同的操作来添加任何自定义标头,在您的情况下是 DKIM 签名。你的iMsg对象变成:

With iMsg
  Set .Configuration = iConf
  .To = recipient
  .From = "foo@bar.com"
  .Subject = "subject"
  .HTMLBody = "body"
  .Fields("urn:schemas:mailheader:DKIM-Signature") = "YOUR_SIGNATURE_HERE"
  .Send
End With

我希望这会有所帮助。

于 2012-05-23T19:10:24.023 回答