Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 406
  • Last Modified:

Supressing prompts when sending e-mail with Outlook

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
YZlat
Asked:
YZlat
  • 2
1 Solution
 
Angelp1ayCommented:
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
 
footechCommented:
I would ask why you are sending via Outlook instead of just using the Send-MailMessage cmdlet.
0
 
YZlatAuthor Commented:
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
 
YZlatAuthor Commented:
Thanks
0

Featured Post

New Tabletop Appliances Blow Competitors Away!

WatchGuard’s new T15, T35 and T55 tabletop UTMs provide the highest-performing security inspection in their class, allowing users at small offices, home offices and distributed enterprises to experience blazing-fast Internet speeds without sacrificing enterprise-grade security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now