Solved

Supressing prompts when sending e-mail with Outlook

Posted on 2013-12-09
4
351 Views
Last Modified: 2013-12-19
I am sending an e-mail with MS Outlook via PowerShell and the script below works great, except it displays a number of prompts which i want to suprss, since in the future the script will run from Windows scheduler. Can anyone help?

$ol = New-Object -comObject Outlook.Application 
$message = $ol.CreateItem(0)
$message.Recipients.Add("test@me.com")  
$message.Subject = "Report"  
$message.Body = "Attachment contains one report"

# Attach a file 
$file = "C:\TestReport.csv"

$message.Attachments.Add($file)
$message.Send()

Open in new window

0
Comment
Question by:YZlat
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
Angelp1ay earned 500 total points
ID: 39707222
Are they messages like this?
A program is trying to perform an action that may result in an e-mail message being sent on your behalf. If this is unexpected, click Deny and verify your antivirus software is up-to-date.

If so this Microsoft help article seems exactly what you want! I've tried to extract the relevant bit for you below :)

http://office.microsoft.com/en-ca/outlook-help/i-get-warnings-about-a-program-accessing-e-mail-address-information-or-sending-e-mail-on-my-behalf-HA001229943.aspx
Prevent this security warning from appearing again
Under certain conditions, installing an antivirus program and keeping it updated regularly might prevent this security warning from appearing again. The conditions are as follows:

- Your antivirus software must be compatible with Microsoft Windows XP Service Pack 2 (SP2). Check with your antivirus software vendor.
- Your antivirus software must be updated regularly. Most antivirus programs enable you to get automatic updates when you are online. Check with your antivirus software vendor.
- Your antivirus software is configured to share its update status with other applications. Typically, antivirus programs share their update status with other applications by default.

To check the update status setting, look in the preferences or options for your antivirus program, or check with your antivirus software vendor.

View security settings in the Trust Center
The Programmatic Access security settings in the Trust Center provide the following options:

- Warn me about suspicious activity when my antivirus software is inactive or out-of-date (recommended)     This is the default setting in Office Outlook 2007. Suspicious activity refers to an untrusted program attempting to access Outlook.
- Always warn me about suspicious activity     This is the most secure setting and you will always be prompted to make a trust decision when a program attempts to access Outlook.
- Never warn me about suspicious activity (not recommended)     This is the least secure setting.

To view these settings, do the following:
- On the Tools menu, click Trust Center.
- Click Programmatic Access.
0
 
LVL 39

Expert Comment

by:footech
ID: 39707427
I would ask why you are sending via Outlook instead of just using the Send-MailMessage cmdlet.
0
 
LVL 35

Author Comment

by:YZlat
ID: 39727521
I can only use SMTP server name on production servers but to send e-mail from development machine I cannot use Send-MailMessage. Outlook allows me not to spcify SMTP server
0
 
LVL 35

Author Closing Comment

by:YZlat
ID: 39730352
Thanks
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help you understand what HashTables are and how to use them in PowerShell.
A procedure for exporting installed hotfix details of remote computers using powershell
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question