So i have the below script which basically 'imports' the log file from a robocopy task and then emails me the last 14 lines ( which are basically the stats at the end). However i cant seem to get the format correct. Here is the script :
$logfile_offsite = "C:\offsitebackup.log"
$log_contents = Get-Content $logfile_offsite
$date = Get-Date -Format g
$footer = get-content $logfile_offsite | select-object -Last 14
#Send email
$smtp_server = "smtp.server.com"
$address_to = "[email protected]"
$address_from = "[email protected]"
Send-MailMessage -SmtpServer $smtp_server -To $address_to -From $address_from -Subject " Offsite Backup $date " -Body " $footer "
So when the email comes through the original formating where it looks neat is screwed up. Is there any way to fix this?