logo
down
shadow

Powershell - formatting output of body info for sending via email


Powershell - formatting output of body info for sending via email

Content Index :

Powershell - formatting output of body info for sending via email
Tag : email , By : Kyle
Date : November 29 2020, 09:01 AM

I wish this help you I think, you need to use pre tag to include preformatted text into your e-mail message:
$mailBody = -join @(
    'Here is a list of the files: <p>'
    '<pre>'
    $files|Format-Table -AutoSize `
    -Property @{Label='Filename';Expression='Name'},
              @{Expression='CreationTime';Format='dd/MM/yyyy hh:mm tt'},
              @{Label='Size';Expression={"$([math]::Round($_.Length / 1kb)) KB"};Alignment='right'} |
    Out-String -Width ([int]::MaxValue)
    '</pre>'
    "Total Number of Files: $($files.Count)"
)

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Incorrect HTML formatting when sending email from PowerShell to Lotus Notes user


Tag : development , By : Pieter Taelman
Date : March 29 2020, 07:55 AM
may help you . You're going to have to go to the Notes client, and view the MIME source of both messages and compare them using a good diff program. If one is displaying correctly, and the other is not, there will be differences, and finding out why and those differences occur should give you some clue about what is happening to break the message.
(The above is assuming that the recipient is set up to receive the message in his mailbox in MIME format. If, in fact, the user has been set up to receive messages converted to Notes rich text format, then you would have to go to the Domino server instead of the Notes client, and use the SMTPSaveImportErors setting to capture the MIME source for the two messages.)

Powershell Output do not comes in proper format in email body


Tag : windows , By : Juan Pablo
Date : March 29 2020, 07:55 AM
I wish this help you The powershell.exe console displays your formatted output using a monospaced font (ie. fixed-width characters).
Your email client probably doesn't use a monospaced font.
foreach ($BODY in $SEND )
{
    $messagebody = $messagebody + $BODY + "`r`n`n"
}

$messagebody = "<pre>$messagebody</pre>"

Send-MailMessage -From "xx@xx.com" -To "yy@yy.com" -BodyAsHtml:$true -Subject "Windows Pstage Disk Status" -Body "Disk are below 20% `n$($messagebody)" -SmtpServer smtp.xxx.com

Html table output formatting when sending email from Microsoft Outlook using R


Tag : css , By : user185283
Date : March 29 2020, 07:55 AM
it should still fix some issue I havent done 'r' but the syntax looks logical so I will take a stab at the solution:
body <- paste0("<html><head><style>body{font-family:Arial, "sans-serif";}table{border-left:1px solid #000000;border-top:1px solid #000000;}table td{border-right:1px solid #000000;border-bottom:1px solid #000000;font-size:16px; font-weight:normal;}table th{border-right:1px solid #000000;border-bottom:1px solid #000000;font-size:16px; font-weight:bold;}</style></head><body>", y, "</body></html>")
<style>
    body{font-family:Arial, "sans-serif"}
    table{border-left:1px solid #000000;border-top:1px solid #000000;}
    table td{border-right:1px solid #000000;border-bottom:1px solid #000000;font-size:16px; font-weight:normal;}
    table th{border-right:1px solid #000000;border-bottom:1px solid #000000;font-size:16px; font-weight:bold;}
</style>

Sending output via Email from Powershell


Tag : powershell , By : user121405
Date : March 29 2020, 07:55 AM
should help you out You're just printing out cert with the filter, not applying it back to cert. To fix, just set $cert equal to the filtered version of itself.
$cert = $cert | Select-Object "Service Name", "Certificate Expiration Date" | Where-Object {$_."Certificate Expiration Date" -as [datetime] -le $deadline} 

Sending R Markdown output as body email via outlook (RDCOMclient)


Tag : r , By : Bart van Bragt
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
shadow
Privacy Policy - Terms - Contact Us © scrbit.com