Results 1 to 5 of 5

Thread: Image not appearing

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    469

    Image not appearing

    Hello

    I am trying to use a background image in a SMTP HTML email with the following code, but the image does not appear:

    Code:
    Dim Logo As New LinkedResource(Server.MapPath("~/Images/emailBG.jpg"), "image/jpeg") 'embedded image
                Logo.ContentId = "emailBG"
    The background image lives in my Images folder in Solution Explorer, and is 600px x 600px which doesn't seem big according to a few articles I have read (some images are far bigger).

    The SMTP code is otherwise fine - the user receives his email.

    What could be the problem, please?

  2. #2
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,458

    Re: Image not appearing

    If you look at the source of the email what is the src attribute pointing to? Is the url accessible publicly?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    469

    Re: Image not appearing

    Thanks for your reply.

    No. The image exists only in a folder in Solution Explorer. As far as I know, with email images, src is replaced by CID which I have done here:

    Code:
    Logo.ContentId = "emailBG"
    None of the images used on this site have a URL - they are all in that Images folder in Solution Explorer.

  4. #4
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,458

    Re: Image not appearing

    If you look at the email's source does it appear that the images have been embedded? It might be worth checking in the debugger that it is evaluating the path to the image correctly as well.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    469

    Re: Image not appearing

    Thanks again.

    It's a bit bizarre. If I click on the body of the received email, right-click, and chose 'View Source', I can only see this the line of text that invites the user to click on a link to reset his password. If I click outside the received email, but still in the main inbox window of the user (me, in this case), I can see that my background image has been sent as an attachment -

    Name:  attach.jpg
Views: 54
Size:  10.9 KB

    in other words, no, it does not seem to be embedded, which means that, somewhere the code is wrong!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width