You're sending the message as a MIME-type message, but there is no MIME header 
for the image (you're not appending it anywhere), so the src="..." doesn't 
point to anything that the client email application has access to. Additionally 
as Ben pointed out, the HTML source isn't valid.

Cheers
Ken

From: Matthew Bullock [mailto:[email protected]]
Sent: Sunday, 27 February 2011 3:54 AM
To: NT System Admin Issues
Subject: RE: PS send email w/ embedded image

Hi Michael, thanks  for the reply.  Unfortunately that didn't change anything.  
A friend of mine who is a .Net dev said something about adding the attachment 
to the message but I cant seem to figure out the right statement.  >From what 
I've read, it should be something like 
$messageParameters.Attachment.Add("$Attachment") but it just throws an error.

-matt

From: Micheal Espinola Jr [mailto:[email protected]]
Sent: Friday, February 25, 2011 6:16 PM
To: NT System Admin Issues
Subject: Re: PS send email w/ embedded image


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]<mailto:[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]<mailto:[email protected]>"
                                To = "[email protected]<mailto:[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]<mailto:[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]<mailto:[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]<mailto:[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