title: How do you embed a variable into HTML within powershell?
body: <p>I have an automated script which is importing users from a csv file into Active Directory.  I would like to send an email out for each user created with their username and password to the new users administrator for onboarding.  It's currently sending the email for each user but it's not embedding the username and password.</p>
  
  <pre><code>$newadstaff = Import-CSV "newad-staff.csv"
  $mailpwd = ConvertTo-SecureString 'helpdeskpassword' -AsPlainText -Force
  $cred = New-Object System.Management.Automation.PSCredential 'helpdesk@google.com',$mailpwd
  $googusr = $_.'HomePage'
  $googpwd = $_.'AccountPassword'
  $Body = @"
  &lt;style&gt;
  .colorchange {color:#4F81BD;}
  ind {text-indent:50px;} 
  &lt;/style&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;body&gt;
  &lt;div style="background-color:#3059D6; color:white; padding:20px;"&gt;
  &lt;p style="font-family:Tahoma, Geneva, sans-serif; font-size:40pt"; align=center&gt;&lt;b&gt;NEW STAFF USER ACCOUNT&lt;/b&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;p style="font-family:Tahoma, Geneva, sans-serif; font-size:20pt"&gt;A new Google account has been created for: &lt;/p&gt;
  &lt;p style="font-family:Tahoma, Geneva, sans-serif; font-size:12pt"&gt;Please navigate to &lt;a href="https://google.com/accounts"&gt;Google Account Login&lt;/a&gt; and login with the below credentials. You will be prompted to change your password after logging in:&lt;/p&gt;
  &lt;p style="font-family:Tahoma, Geneva, sans-serif; font-size:12pt"&gt;&lt;b&gt;Username: $googusr &lt;/b&gt;
  &lt;p style="font-family:Tahoma, Geneva, sans-serif; font-size:12pt"&gt;&lt;b&gt;Password: $googpwd &lt;/b&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  "@
  
  $param = @{
  SmtpServer = 'smtp.gmail.com'
  Port = 587
  UseSsl = $true
  Credential  = $cred
  From = 'helpdesk@google.com'
  To = 'admin@google.com'
  Subject = 'New User Account'
  Body = $body
  
  }
  $When = ((Get-Date).Addhours(-1)).Date
  Get-ADUser -Filter {whenCreated -ge $When} -Properties whenCreated | export-    csv "newad-staff.csv"
  
  Foreach ($user in $newadstaff)
  {
  Send-MailMessage @param -BodyAsHtml
  }
  </code></pre>