locked
Send-MailMessage and Automatic Email Generation with Exchange 2007 RRS feed

  • Question

  • Good morning everyone,

    Is it possible to create a powershell script to automatically send messages with Send-MailMessage? I've been asked if we can make Exchange/Outlook automatically generate its own emails to send. My answer was no, you generally need a third party tool to do this, such as SendLater or have an application that processes emails through Exchange automatically.

    Then we came upon Send-MailMessage and while I can send emails to myself all night and day, I need to know if I can send with this command automatically throughout the day. I'm somewhat still new to powershell scripting and not sure where to begin or if this is even possible.

    Thanks for any assistance!

    Wednesday, June 18, 2014 3:49 PM

Answers

  • You could schedule the script using Task Scheduler.  To do that, you'd need to schedule PowerShell to run and launch your script.


    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."


    Wednesday, June 18, 2014 4:16 PM

All replies

  • Try
    http://blogs.msdn.com/b/powershell/archive/2009/10/30/sending-automated-emails-with-send-mailmessage-convertto-html-and-the-powershellpack-s-taskscheduler-module.aspx


    Example : PS C:\> send-mailmessage -from "User01 <user01@example.com>" -to "User02 <user02@example.com>", "User03 <user03@example.com>" -subject "Sending the Attachment" -body "Forgot to send the attachment. Sending now." -Attachments "data.csv" -priority High -dno onSuccess, onFailure -smtpServer smtp.fabrikam.com

    Wednesday, June 18, 2014 4:10 PM
  • You could schedule the script using Task Scheduler.  To do that, you'd need to schedule PowerShell to run and launch your script.


    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."


    Wednesday, June 18, 2014 4:16 PM
  • Hi ExAdmin29,

    Great information from Ed.

    I also find a related blog contains detailed steps, for your reference:

    Creating Scheduled Tasks for Exchange 2010 PowerShell Scripts

    http://www.mikepfeiffer.net/2010/02/creating-scheduled-tasks-for-exchange-2010-powershell-scripts/

    Disclaimer:

    Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.

     

    Thanks

    Mavis


    Mavis Huang
    TechNet Community Support

    Tuesday, June 24, 2014 7:57 AM