title: VBScript - Best way to confirm that the email has been received
body: <p>I sent an email to someone using this basic vbscript code and it works great but I want to confirm that the email has been received.
  Is there a way to do this?
  The code I use to send mail is:</p>
  
  <pre><code>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
  </code></pre>
  
  <p><strong>UPDATE</strong> I update my code and now I get notification to some e-mail.</p>
  
  <pre><code>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
  </code></pre>
  
  <p>With this code when user that send to him the mail open the mail and try to close the mail then open popup that ask if he want to notification that he receipted the mail.</p>
  
  <p>I not found a way that it's automatic send a notification.</p>