First time posting hopefully you guys can help
I am using the below script to try and attach a htm/html as the body
of an email. The HTML is an export of a free disk report unfortunately
no matter what i do with the attachment section the only this that
shows up is the path i.e. "D:\apps\1.htm" show's up i've tried |
convert-tohtml etc just get things like *16 or *24 in the body of the
email.
$logFilePath = "C:\Documents and Settings\xzw6qc
\AAUNSWC48_20100206.htm"
$body = "C:\Documents and Settings\xzw6qc\AAUNSWC48_20100206.htm"
#Email function
function sendmail($attachment)
{
$SmtpClient = New-Object system.net.mail.smtpClient
$MailMessage = New-Object system.net.mail.mailmessage
$Attachment = New-Object System.Net.Mail.Attachment($logfilepath)
$SmtpClient.Host = “mailrelay.XXXX”
$mailmessage.from = “test@XXXX"
$mailmessage.To.add(“anthony.hughes@XXXX”)
$mailmessage.Subject = “Storage Group Copy Status report”
$MailMessage.IsBodyHtml = 1
$mailmessage.Body = $body
$MailMessage.Attachments.Add($Attachment)
$smtpclient.Send($mailmessage)
}
sendmail $AllServers
All i get is the attachment and
C:\Documents and Settings\xzw6qc\AAUNSWC48_20100206.htm in the body
want is as viewable in the email without it being an attachment :-)
Any help would be muchly appreciated...
if( $attachments -ne "" ) {
foreach($private:attachment in $attachments) {
if(Test-Path $attachment) {
[System.Net.Mail.Attachment] $private:data = new-object
System.Net.Mail.Attachment( $attachment );
$message.Attachments.Add( $data );
}
}
}
Martin
"OK" <O...@discussions.microsoft.com> wrote in message
news:BD308593-1EDC-4F3F...@microsoft.com...
Martin
"OK" <O...@discussions.microsoft.com> wrote in message
news:7C24033B-5C62-48F3...@microsoft.com...