Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Format part of email body (bold some of the text) in Powershell

$
0
0

Hi,

After a lot og googling without finding an answer I have come to you guys. I’ll try to keep this as short and concise as possible.

The powershell script basically:

  • Retrives a lot of values from an ADObject
  • Creates an email draft
  • Opens a new outlook window with all the information (recipient, subject, body) filled out (but not sent)

The relevant part of the code is:

$emailtext ="Hi, Please add <b>$fullname</b> to <b>$services</b> <b>Firstname:</b> $givenname <b>Surname:</b> $surname <b>Username:</b> $user <b>Email:</b> $email <b>Title:</b> $title <b>Manager:</b> $manager <b>Department:</b> $department <b>Office location:</b> $office <b>Start date:</b> $startdate Thanks!" $mailobject = New-Object -comObject Outlook.Application $mail = $mailobject.CreateItem(0) $mail.to = "$desiredemails" $mail.Subject = "Please add new employee $fullname to $desiredservices" $mail.Body = "$emailtext" $mail.Display() 

The <b>text</b> obviously doesn’t do anything. If I use the Send-MailMessage I could get bold text with parameters, but this method above would be ideal. So my question is:

Is it possible to get the text above marked with <b></b> to appear bold when the outlook window pops up?

Thanks!

submitted by /u/playseek
[link] [comments]

The post Format part of email body (bold some of the text) in Powershell appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles