Could be because the header for MediaType should be "image/jpeg" ?

--

ME2






On Fri, Feb 25, 2011 at 5:47 PM, Matthew Bullock <[email protected]> wrote:

> I was  hoping someone might be able to help me out with a poweshell
> script.  The script sends a simple email, but I’m trying to embed a logo
> image and it’s not working.  All I get is an empty square for the image.
>
>
>
> Any help would be much appreciated,
>
>
>
> -matt
>
>
>
>
>
> $Attachment = New-Object System.Net.Mail.Attachment("C:\scripts\logo.jpg")
>
> $Attachment.ContentDisposition.Inline = $True
>
> $Attachment.ContentDisposition.DispositionType = "Inline"
>
> $Attachment.ContentType.MediaType = "image/jpg"
>
> $Attachment.ContentId = "logo"
>
>
>
>
>
> $body = {
>
>                 <html xmlns:o="urn:schemas-microsoft-com:office:office"
> xmlns:v="urn:schemas-microsoft-com:vml">
>
>     <head>
>
>       <style type='text/css'>
>
>         BottomRight {
>
>           position: absolute;
>
>           bottom: 2px;
>
>           right: 4px;
>
>         }
>
>       </style>
>
>     </head>
>
>     <body>
>
>                                 <font face="calibri, helvetica" size="2">
>
>                                 <p>Hello</p>
>
>                                 </font>
>
>                                 <div id='BottomRight'>
>
>                                                 <img src='cid:logo
> alt=logo'/>
>
>                                 </div>
>
>     </body>
>
>   </html>
>
> }
>
>  $messageParameters = @{
>
>                                 From = "[email protected]”
>
>                                 To = "[email protected]”
>
>                                 SmtpServer = “mxserver"
>
>                                 Subject = "Test Email"
>
>                                 Body = $body
>
>                                 }
>
> Send-MailMessage @messageParameters -BodyAsHtml
>
> $Attachment.Dispose()
>
> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~
> ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~
>
> ---
> To manage subscriptions click here:
> http://lyris.sunbelt-software.com/read/my_forums/
> or send an email to [email protected]
> with the body: unsubscribe ntsysadmin
>

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin

Reply via email to