Many of your scripts require to send mail. There are several ways to send mail, but I am introducing you with SMTP mail sending script here. The code will accept below values which either you can hard-code inside the script or you can make a config file or ini file to get the settings. Below is simple piece of code for the same:
How to send mail to multiple recipients?
This can be done by modifying NOTIFY_ID variable with below -
$NOTIFY_ID=som@foo.com,john@foo.com
Make sure you are using a comma(,) to separate two Mail-Ids.
How to Send HTML Formatted mail using Powershell ?
This is another good option which can be done easily with Powershell. You need to just add one more line inside the code:
Easy and Simple. Enjoy Scripting!!
How to send mail to multiple recipients?
This can be done by modifying NOTIFY_ID variable with below -
$NOTIFY_ID=som@foo.com,john@foo.com
Make sure you are using a comma(,) to separate two Mail-Ids.
How to Send HTML Formatted mail using Powershell ?
This is another good option which can be done easily with Powershell. You need to just add one more line inside the code:
Easy and Simple. Enjoy Scripting!!
I have updated the article with attachment option.
ReplyDeleteThe message indicates that the message you supplied to the smtp server is not accepted for some reason, but doesn't really say what piece went wrong. You could try this article:
ReplyDeletehttp://www.powershellcave.com/?p=46
It was really helpfull for me when I tried understanding the powershell email functions.
So, here is a question. I used the above script but I keep on getting double messages. Why would that happen?
ReplyDeleteBy double messages, I mean I get double emails from the script.
ReplyDelete