How to Send an Email With Powershell

Written by keith perry
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Send an Email With Powershell
E-mail is a primary method to notify users from a PowerShell program. (Medioimages/Photodisc/Photodisc/Getty Images)

PowerShell is a powerful shell and script language for later versions of the Windows operating system. PowerShell can be used for different functions, including monitoring of systems or applications. Sending an e-mail is standard procedure of notifying users when an issue has occurred. The PowerShell language is equipped with a Send-MailMessage cmdlet capable of sending e-mail. E-mails produced from this cmdlet can include attachments, use secure ports and contain a subject line.

Skill level:
Moderate

Other People Are Reading

Things you need

  • Windows XP or later
  • SMTP server

Show MoreHide

Instructions

  1. 1

    Click on the icon "Start" located on the Windows task bar. Then click "Programs," "Accessories" and "WordPad" to start the WordPad program.

  2. 2

    Insert the following text in to the WordPad window:

    send-mailmessage -to "ToUser <ToUser@test.com>" -from "FromUser <FromUser@test.com>" -subject "PowerShell Email" -body "This is the body of the email" -SmtpServer "smtp.provider.net"

  3. 3

    Edit the text in the WordPad window, changing the data "ToUser" and "FromUser" to the name you wish to send the email to and from. Change the body and subject information to meet your needs. Edit the "smpt.provider.net" to the smtp server you access for sending mail.

  4. 4

    Open the PowerShell program from the "Start" icon on the Windows task bar. Select "Programs," "Accessories" and "Windows PowerShell."

  5. 5

    Copy the text from the WordPad screen and paste at the PowerShell command prompt. Press "Enter" to send the email from PowerShell.

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.