Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Outlook using powershell

Posted on 2014-01-30
1
Medium Priority
?
4,184 Views
Last Modified: 2014-01-30
Hi

Trying to create a powershell script to send emails via outlook 2010 to multiple recipients, attach files from a specified location.

Please advise the best way to proceed with this. Thanks
0
Comment
Question by:ahmedla1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 40

Accepted Solution

by:
Subsun earned 2000 total points
ID: 39820440
You may use Send-MailMessage command which doesn’t require outlook..
Here is an example..
$to="User@domain.com","User2@domain.com"
Send-MailMessage -From "Sub@domain.com" -To $to -Subject "Testing" -Body "This is my test mail" -Attachments "C:\temp\test.txt" -SmtpServer smtp.domain.com

Open in new window

Refer this article for more details about Send-MailMessage
http://technet.microsoft.com/en-us/library/hh849925.aspx

If you want to use outlook then, here is an example..
$ol = New-Object -comObject Outlook.Application  
$mail = $ol.CreateItem(0)  
$Mail.Recipients.Add("User1@domain.com") 
$Mail.Recipients.Add("User2@domain.com") 
$Mail.Attachments.Add("C:\temp\test.txt") 
$Mail.Subject = "Testing"  
$Mail.Body = "This is my test mail"  
$Mail.Send() 

Open in new window

0

Featured Post

Problems using Powershell and Active Directory?

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 lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
A walk-through example of how to obtain and apply new DID phone numbers to your cloud PBX enabled users that are configured in Office 365. Whether you have 1, 10 or 100+ users in your tenant, it's quite easy to get them phone-enabled and making/rece…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

604 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