YZlat
asked on
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()
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I would ask why you are sending via Outlook instead of just using the Send-MailMessage cmdlet.
ASKER
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
ASKER
Thanks