Table of Contents


You can automate or schedule this to run occasionally.

You are sending static mails everytime across number of users, you can simple use this script to do your job.

Let the script do its job and you sit back and relax.


# Hi, This script will help you to format mail

# You can use this to automate/schedule mail

# You can also convert this ps1 to exe and schedule it

# I hope it helps :)


#If you want to sent attachment in mail pls mention filename path below

$dir = "c:\temp\yourfilename.suffix"



#If you to add dynamic date so that whenever you schedule it should take that particular date

$titleDate = get-date -uformat "%m-%d-%Y - %A"


#here goes our code :)

 $smtpsettings = @{

BodyAsHtml = $true

To =  ""

cc = "" 

From = "mailveliveryfrom@id"

Subject = "Your subject here $titledate"

SmtpServer = "Your smtp server name here"

Body =

Hi Team,<br>


This is first line of the body.</br>


<br>This is second line of the body.</br>


<br><b>This is third line of the body.</b></br>




table, th, td, tr {

    border: 1px solid black;

    border-collapse: collapse;


th, td, tr {

    padding: 5px;

    text-align: left;




  <caption><b>Table Heading</b></caption>


    <th bgcolor='#CDD1F9'>Column Name1</th>

    <th bgcolor='#CDD1F9'>Column Name2</th>

  <th  bgcolor='#CDD1F9'>  Column Name3 </th>



    <td>Col Value1</td>

    <td>Col value2</td>

    <td>Col Value3</td>




<br> <b> This is  Auto generated mail follow -</b></br>"


   Attachments = $dir


Send-MailMessage @smtpsettings


Download Script - CrazyCerebro