Image in HTML Email: how is this done ?

Discussion in 'Software' started by WarKirby, Oct 12, 2010.

  1. WarKirby

    WarKirby Private First Class

    I'm currently trying to figure out how to get a decent html email working with images. All solutions I've found so far get blocked at the client side, forcing the reciever to click "show images" or something of that nature.

    But my boss has just forwarded me an email which manages to get around most image filters. It shows perfectly in outlook express, apple mail, and gmail, although hotmail still blocks it.

    When I use Inspect element in gmail to examine it, the code for the image shows as:

    Code:
    <img border="0" width="700" height="127" src="?ui=2&amp;ik=496dab37ca&amp;view=att&amp;th=12ba0b2eb94a09e5&amp;attid=0.2&amp;disp=emb&amp;realattid=115e7f3d68a5e75c_0.1&amp;zw" alt="Children in Scotland Logo">
    The src attribute is confusing, what's going on there?

    gmail and apple do not show this as an attachment, although hotmail does. How can I send an email with an image like this one?

    If anyone would like the full email for inspection, pm me an address to forward it to
     
  2. Kodo

    Kodo SNATCHSQUATCH

    Oldest trick in the book. Basically, you hit a "handler" on your server which dynamically responds (writes out the response stream) the data for the image with the proper image mime type.
     
  3. WarKirby

    WarKirby Private First Class

    You make it sound so simple :-D

    Could you possibly provide more info on how I could do this? my PHP knowledge is fairly basic
     
  4. Kodo

    Kodo SNATCHSQUATCH

    No clue how to do this in PHP. but I could do it in C# :)
     
  5. WarKirby

    WarKirby Private First Class

    Well that's getting disturbingly complex. I didn't think C# was for serverside apps.

    Not really keen on learning a new programming language for this, is there an easier way? Perhaps some already made application that can run on the server to do the job? We have a webserver and an email server to work with.
     
  6. Kodo

    Kodo SNATCHSQUATCH

    C# is not a scripting language like PHP is. It's a compiled language and LIVES in the "server side" of things when it comes to web apps. Aside from that, I'm sure there is some pre-writtent PHP script out there that does what you want. (ref: http://www.phpfreaks.com/forums/index.php?topic=141121.msg600971#msg600971)
     
  7. vesolovski

    vesolovski Private E-2

    Hello WarKirby,
    can you please tell me if you have already found the solution to this image embedding problem? I am trying to do this as well with no success so far.

    Regards,
    vesolovski
     
  8. mjnc

    mjnc MajorGeek

    Hi vesolovski.

    Sorry you haven't gotten a reply yet to your very first post at MG.

    Why not try starting a new thread and describe specifically what you have tried and what issues you are having.

    It's just possible that no one has anything better to offer at this time.
     
  9. PC-XT

    PC-XT Master Sergeant

    I don't know that any of these will help, but you can try them. These are ways to include images in HTML email:

    External link
    Just give a regular <img> link to the image's URL. If it is local, the program may not block it.

    Multipart/Attachments
    (You probably won't be able to do this in a program that just lets you edit the HTML part of the email. You need to edit the whole source.)
    MHTML:
    http://tools.ietf.org/html/rfc2557
    http://en.wikipedia.org/wiki/MHTML
    http://tools.ietf.org/html/rfc2110 (This one is obsolete, but I included it in case it explains any odd stuff in an old email.)

    cid and mid URIs:
    http://tools.ietf.org/html/rfc2111
    http://tools.ietf.org/html/rfc2392

    Raw data URIs
    As a URI, browsers tend to give the data protocol lower security settings, fearing injection or other issues. It's possible there may be some email readers that allow it, from a local sender or something.
    http://tools.ietf.org/html/rfc2397
    http://en.wikipedia.org/wiki/Data_URI_scheme

    There may be other ways, as well. I included the ones I know about.
    The example given in a previous post could be a local URL, or perhaps an MHTML attachment.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds