Microsoft Outlook security delay

I use the following code to send emails.

   Private Sub SendOutlook(ByVal subject As String, ByVal toe As String, _
     ByVal body As String, ByVal from As String)
      Dim Appl As Object
      Dim out As Object
      Try
         Appl = CreateObject("Outlook.Application")
         out = Appl.CreateItem(0)
         With out
            .Subject = subject
            .To = toe
            .Body = body
            '==============================================
            'to use html in the email instead of plain text
            'use .HTMLBody instead of .body
            '==============================================
            .Send()
         End With
      Catch ex As Exception
         MsgBox("Error " & Err.Number & ": " & ex.Message, MsgBoxStyle.Critical, "Error")
      End Try
   End Sub 'SendOutlook

This works fine, but I send many in a do loop with different messages.
Microsoft Outlook displays a message:
     A program is automatically trying to send an e-mail on your behalf.
     Do you want to allow this?
There is a long pause between each e-mail sent before I can respond Yes.  How can I eliminate this check?

Harold_LominacAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
If you really want to use Outlook, you can automate the Yes by using a add-in: http://www.slipstick.com/outlook/esecup/admin.htm

But personnaly, I avoid using Outlook from applications. Have a look at the System.Web.Mail namespace that you can use even from Windows application.
0
fulp02Commented:
using System.Web.Mail

MailMessage mail= new MailMessage();
mail.TO = "recip@theirdomain.com";
mail.From= "you@yourdomain.com";
mail.subject ="subject";
myMessage.Body ="BODY";

SmtpMail.SmtpServer = "your smtp server";
SmtpMail.Send(mail);
0
fulp02Commented:
Imports System.Web.Mail


Dim mesg As MailMessage = New MailMessage ()

mail.To = "recip@theirdomain.com"
mail.From = "you@yourdomain.com"
mail.subject = "subject"
myMessage.Body = "BODY"

SmtpMail.SmtpServer = "your smtp server"
SmtpMail.Send(mail)


Sorry I wrote that in C#
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Harold_LominacAuthor Commented:
I can't import System.Web.Mail.  Is there something missing in my VB?
0
Harold_LominacAuthor Commented:
To emoreau:
I don't care what method I use to send the e-mails.  The methods should be available to the users.  Perhaps I could automate the "YES" in outlook, but there is a 5-second pause before it comes up.  That is a poor solution, if there is a better way.
0
Éric MoreauSenior .Net ConsultantCommented:
>>I can't import System.Web.Mail.  Is there something missing in my VB?

add a reference to System.Web
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.