Suppress dialog message when sending Outlook message through vb.net

I am programming against the Outlook com object in VB.NET 2005. When I apply the .Send method to the item, the following dialog box pops up and nothing will happen until the user replies. The only problem is I want this to be an automated process running on a disconnected account, so I cannot process message boxes. Anyone know of a way to supress this message through code? I know that programming the Word and Excel obect models have a DisplayAlerts property that can be set to False, but it does not appear that such a property exists in the Outlook object model.

Title: Microsoft Office Outlook

Message:
A program is trying to automatically send an e-mail on your behalf.
Do you want to allow this?

If this is unexpected, it may be a virus and you shoudl choose "No".
LVL 15
dbbishopAsked:
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.

dinomixCommented:
http://www.outlookcode.com/article.aspx?id=52
Here is some information about several ways to do this.

I have done this personally a few years ago and found that using SMTP directly is the easiest way to go, this bypasses outlook alltogether and sends the message driectly. Microsoft has this encapsulated into CDO ( http://msdn2.microsoft.com/en-us/library/ms527525.aspx ) which provides easy smtp functionallity. There are also several 3rd party objects that will bypass this. The reason it is so difficult is because this is a security feature that is designed not to be bypassed so that a malicious program cannot send email on your behalf.
0
dbbishopAuthor Commented:
Do you have an example of instantiating a CDO object, populating it and sending a message? I've added a reference to the MS CDO 1.21 Library in my project, but I'm not sure where to go from there. As I indicated, I'm programming in VB.NET 2005.

I need to set Subject, message text, To, CC, and add an attachment. There will be multiple email addresses in both the To and CC addresses, so I assume they are separated by commas?
0
dinomixCommented:
SUB sendmail( fromWho, toWho, Subject, Body )
Dim objCDO
Dim iConf
Dim Flds

Const cdoSendUsingPort = 2

Set objCDO = new cdo.message
Set iConf = new cdo.configuration
 
Set Flds = iConf.Fields
With Flds
           .Item(cdoSendUsingMethod) = cdoSendUsingPort
           .Item(cdoSMTPServer) = "mail-fwd"          
           .Item(cdoSMTPServerPort) = 25
           .Item(cdoSMTPconnectiontimeout) = 10
           .Update
End With

Set objCDO.Configuration = iConf

objCDO.From = fromWho
objCDO.To = toWho
objCDO.Subject = Subject
objCDO.TextBody = Body
objCDO.Send

END SUB

Something like that, i copied the code from this site (see link below), it is for web but should work with VB.net as typed above. You can use intellisense to play around with the properties, there should be an attachment property that will allow you to attach files. I don't have studio on this pc so i cannot test for you but should be straightforward.

http://www.teamits.com/internet/support/nt/cdo.html
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

dbbishopAuthor Commented:
I get no intellisense against the CDO object. I'll play around but in vb.net you need to specify the datatype in a Dim statement (i.e. Dim objCDO As CDO ), but I get an error that CDO is not a defined type.
0
David LeeCommented:
Hi, dbbishop.

"Anyone know of a way to supress this message through code?"
There's is no way to suppress the message through code or any Outlook setting.  It is a security feature that Microsoft added to Outlook to stop the many viruses and worms written to use Outlook as a transport mechanism.  If you want to continue using Outlook to send from code, then there are two solutions to get around this.

1.  Use Outlook Redemption (http://www.dimastr.com).  Redemption is a third-party library that allows you program around Outlook security.

2.  Use ClickYes (http://www.contextmagic.com/express-clickyes).  ClickYes is a utility that sits in teh system tray and watches for Outlook's security warning dialogs.  When one pops up it clicks the Yes button for you.
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
dbbishopAuthor Commented:
ClickYes works like a CHARM! Thanks.

dinomix: Thanks for the info. Sorry I couldn't get CDO to work, but you initially pointed ot the problem.
0
David LeeCommented:
You're welcome.  Glad I could help.
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
Outlook

From novice to tech pro — start learning today.