Hi, I am tryin to send e-mail automaticaly with vb6, and for this I am using the code down here.

But the problem is with Outlook, when the e-mail should be sent. Outlook pops up a notification: "A program is trying to automatically send an email on my behalf. Do You want to allow this?". And there is to choose YES or NO.

How can this YES be chosen automatically from vb? (Because, the assumption is that user will not be present to click YES after he runs the application!)

VB6 Code:
  1. Dim objOutlook As Object
  2. Dim objOutlookMsg As Object
  3.  
  4. Set objOutlook = CreateObject("Outlook.Application")
  5. Set objOutlookMsg = objOutlook.CreateItem(0)
  6.  
  7. With objOutlookMsg
  8.  
  9.   .To = txt_ToEmail
  10.   .Subject = "Measurement data"
  11.   .Body = "Measurement data are in the attachment"
  12.   '.HTMLBody = "HTML version of message"
  13.    intFileNbr2 = FreeFile
  14.   .Attachments.Add (strFileName2)
  15.   .send
  16.  
  17. End With
  18.  
  19. Set objOutlookMsg = Nothing
  20. Set objOutlook = Nothing