<p class=“_1qeIAgB0cPwnLhDF9XSiJM”>I am trying to send a welcome email to new starters after using a new starter script. Essentially, the starter script waits for them to be created in Office 365 after syncing from our local AD, assigns a license to the user and then waits for the mailbox creation before sending the email. We used to send a welcome email a while ago which I would like to use again but I’m struggling to format it correctly in PowerShell. How can I format the below HTML in PowerShell? Please ignore the content of the email, I need to change that.</p>
<p class=“_1qeIAgB0cPwnLhDF9XSiJM”>I’m struggling with the different styles that are needed throughout the email.</p>
<p class=“_1qeIAgB0cPwnLhDF9XSiJM”>The HTML can be viewed here: https://www.w3schools.com/code/tryit.asp?filename=GBDYKDJC7FKK</p>
I found the below online to use as HTML in my script but I’m not sure how to incorporate my welcome email into that:
#Define some variables for the message
#HTML header with styles
$htmlhead="<html>
<style>
BODY{font-family: Arial; font-size: 10pt;}
H1{font-size: 22px;}
H2{font-size: 18px; padding-top: 10px;}
H3{font-size: 16px; padding-top: 8px;}
</style>"
#Header for the message
$HtmlBody = "<body>
Welcome to Our Company
<p>Generated: $(Get-Date -Format g)</p>
<u>We're Pleased to Have You Here</u>
"
$htmlHeaderUser = "New User " + $User.DisplayName + "
"
$htmlline1 = "<p>Welcome to $company</p>"
$htmlline2 = "<p>You can open Office 365 by clicking here </p>"
$htmlline3 = "<p>Have a great time and be sure to call the help desk if you need assistance.</p>"
$htmlbody = $htmlheaderUser + $htmlline1 + $htmlline2 + $htmlline3 + "<p>"
$HtmlMsg = "</body></html>" + $HtmlHead + $HtmlBody