2
我用这个基本的VBScript代码发送了电子邮件,有人和它的作品很好,但我想确认邮件已收到。 有没有办法做到这一点? 我用它来发送邮件的代码是:的VBScript - 最佳的方式来确认邮件已收到
Dim objMessage 'object mail
Set objMessage = CreateObject("CDO.Message")
objMessage.BodyPart.Charset = "utf-8"
objMessage.Subject = subjectStr
objMessage.From = "To someone"
objMessage.To = toWhoStr
objMessage.TextBody = contentStr
objMessage.AddAttachment AttachmentFile
'==This section provides the configuration information for the remote SMTP server.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "ip smtp server"
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1'cdoBasic
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = false
'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
objMessage.Send
Set ObjMessage = Nothing
UPDATE更新我的代码,现在我得到通知,一些电子邮件。
Const CDO_SUCCESS = 4 ' sends delivery receipt if succesfull
Const CDO_FAIL = 2 ' sends delivery receipt if fails
Const CDO_DELAY = 8 ' sends delivery receipt if delayed
Const CDO_SUCCESS_FAIL_DELAY = 14 ' sends delivery receipt always
Dim objMessage 'object mail
Dim iConf
Dim Flds
Set objMessage = CreateObject("CDO.Message")
set iconf = createobject("cdo.configuration")
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "ip smtp server"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1'cdoBasic
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Update
End With
'==End remote SMTP server configuration section==
With objMessage
.BodyPart.Charset = "utf-8"
Set .Configuration = iConf
.To = toWhoStr
.From = "from who"
.Subject = "BLA BLA BLA"
.TextBody = "PING PONG"
.fields("urn:schemas:mailheader:disposition-notification-to") = "email to notification"
.fields("urn:schemas:mailheader:return-receipt-to") = "email to notification"
.DSNOptions = 14
.fields.update
.Send
End With
Set ObjMessage = Nothing
有了这个代码时发送给他的邮件用户打开邮件,并尝试关闭然后如果他想通知他签收邮件是询问邮件打开弹出窗口。
我没有找到一种方法,它是自动发送通知。
我更新我的sulotion问题 – tal