Embedding an image in an email with HTML

Discussion in 'Web Design and Development' started by pcproff, Jan 27, 2006.

  1. macrumors member

    pcproff

    Joined:
    Jul 14, 2004
    Location:
    Ft. Lauderdale,FL.
    #1
    Guys,
    I am designing an invitation for a client that will go out to the readers of his book for a signing. How do I embedd an image into an email? I dont want to just attach an image into the body of the email. I know there is a way to do it via HTML (if the viewer has HTML read options on the email) Can anyone help?
     
  2. macrumors 68000

    Joined:
    Jun 13, 2004
    Location:
    afk
    #2
    I'm not sure how to do it in Mac (I just switched not too long ago). You can actually do it in outlook express. Click on edit source, paste in your html codes with the image linking back to your local drive image location, and when you send outlook express will automatically attach and embedded the image inline for you. I'm not on my mac now, so I can only find it out if it works in Apple Mail when I get home.
     
  3. thread starter macrumors member

    pcproff

    Joined:
    Jul 14, 2004
    Location:
    Ft. Lauderdale,FL.
    #3
    Hey Neo thanks for the help I am sure I can do it in Outlook but it would be nice to find out how to do it in Mail. Thanks for all your help.
     
  4. macrumors 68000

    Joined:
    Jun 13, 2004
    Location:
    afk
    #4
  5. macrumors 6502

    Joined:
    Oct 15, 2003
    #5
    Unless the readers of his book are an unusual lot and/or are actively expecting such an email, putting a $##@$% image and HTML formatting into the email for your client is going to dramatically reduce the number of people who will ever see it.

    Lots of folks set their spam filters to toss anything with HTML formatting straight into the trash.

    Many others who don't do that do nevertheless have their email client set to NOT render HTML (because it is used by spammers to verify valid email addresses) and so they may see the email despite the HTML and the embedded image but what they will actually be seeing is your raw ugly bracket-laden code.

    Email is a text-only medium and should stay that way.

    :mad:

    [/geezer mode]
     
  6. thread starter macrumors member

    pcproff

    Joined:
    Jul 14, 2004
    Location:
    Ft. Lauderdale,FL.
    #6
    umm.. ok lol. So if your so against that, what would you do to contact 485 people via email?? Explain that one.
     
  7. jsw
    Moderator emeritus

    jsw

    Joined:
    Mar 16, 2004
    Location:
    Andover, MA
    #7
    Actually, the vast majority of email users simply use their email programs with their default setups - which, with Mail and most apps, means they'll display images that are linked in via HTML.
    Lots? Yes, agreed. Most? No.
    Again, most users don't go to the effort to do this, although they should. However, the lack of a bounced email often serves to indicate the validity of an email address, so the image loading is usually a secondary, although more reliable, way of verifying an address.
    I only partially agree - email, like postal mail, is at its ugliest when it's text-only, and the only valid reason I see for keeping it that way is to make it harder for spammers to verify an email address, which seems a bit ridiculous.

    You could always provide a URL in the email which users could click on to go to a site which contained the content you would have emailed to them otherwise.
     
  8. Moderator emeritus

    Mitthrawnuruodo

    Joined:
    Mar 10, 2004
    Location:
    Bergen, Norway
    #8
    Why do you need to have a html mail just because you want to mail 485 people...??? :confused:

    Just make a group in Address Book, compose a nice plain text message and BCC the group...

    7 reasons why HTML email is a bad thing.

    Why you shouldn't use HTML email
     
  9. macrumors 68040

    decksnap

    Joined:
    Apr 11, 2003
    #9
    Typically when you send out HTML emails, you are supposed to provide a plain text version also. So whatever the end user has their prefs set to, they get a legitimate looking email either way. I would do some more research on the subject. I'm not an expert, but I've learned a bit about it along the way. Another thing is typically all the images are served from a site somewhere, so you would use all absolute links in your email HTML and point them to the server where the images are stored.

    Try looking at the source code for a few emails in Mail. That might help get you started. (View > Message > Raw Source)

    You can also employ a service for this sort of thing if you are going to be doing it on a repetitive basis. Something like:

    http://www.constantcontact.com

    You can upload and manage your databases, use templates, or make your own.
     
  10. thread starter macrumors member

    pcproff

    Joined:
    Jul 14, 2004
    Location:
    Ft. Lauderdale,FL.
    #10
    My boss had me design an invitation promoting the book and he wants me to email this to people on the waiting list for the book. Well I know that HTML email is not the way to go and I never have my mail client with HTML view enabled. I will include text obviously when sending this to his clients in case they have the HTML disabled. I mean its not like we are spamming people these are clients of his that want to be emailed. I am thinking doing something like <img="http://www.url.com/pic.jpg> Is this right? If so where do I insert it?
     
  11. macrumors newbie

    Joined:
    Dec 3, 2008
    Location:
    Bournemouth, England
    #11
    no attachments?

    I have designed my email in html and embedded my images within it like this:
    <img src="http://domain/image.jpg" />. although my images are stored on my server, every time I send the email to test it, it attaches all the images. I would prefer this not happen and haven't found any solution.

    anybody able to shed some light on this?

    thanks in advance.
     
  12. Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #12
    What software are you using to create the HTML and also send the email?
     
  13. macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #13
    That was sound, expert advice, actually. That is the proper way to handle the situation as developers. In a single E-Mail both HTML and text versions may be specified using special headers and a boundary command for each. Then upon delivery the client mail reader will present whichever format the user has selected as their default view. This is the process. Below I've included an example of how it's done in actual code.

    Developers first need to learn the various mail headers/boundary commands, then simply write a script that generates e-mail combining both formats, like this:

    Code:
    Date: Mon, 11 Feb 2002 16:08:19 -0500 
    To: The Receiver <recipient@some.net> 
    From: The Sender <sender@some.net> 
    Subject: A simple mixed message 
    MIME-Version: 1.0 
    Content-Type: multipart/alternative; 
                  boundary="==Multipart_Boundary_xc75j85x" 
     
    This is a multi-part message in MIME format. 
     
    --==Multipart_Boundary_xc75j85x 
    Content-Type: text/plain; charset="iso-8859-1" 
    Content-Transfer-Encoding: 7bit 
     
    This is the text portion of the mixed message. 
     
    --==Multipart_Boundary_xc75j85x 
    Content-Type: text/html; charset="iso-8859-1" 
    Content-Transfer-Encoding: 7bit 
     
    <html> 
    <body> 
    <p>This is the <b>HTML portion</b> of the mixed message.</p> 
    </body> 
    </html> 
    
    --==Multipart_Boundary_xc75j85x--
    
    See the differences in the Content-Type header, text/plain vs. text/html? And the mulitpart boundry used to separate the two formats? That's what it takes "under the hood" for all software to make the magic happen. As you can see some of the headers seem to be software generated with random data (re: boundary) plus the double equal signs and double dashes that have to be perfectly setup. This is intended to comply with strict email RFC standards.

    There are many PHP classes out there that simplify the mail sending process so you can do things like this concentrating on the email content and not the RFC's. Here is one called PHPMAILER, for example, use the one at the top. On that page are also other versions that not only send both formats, but allow powerful list serve functions for e-mail subscriptions and database recipient lists as well. It's an amazing set of classes. 5 out of 5 stars.

    -jim
     
  14. macrumors regular

    Joined:
    May 1, 2008
    #14
    Just in case you want to do more than send images, I'll point you to an article on formatting html emails. That should help to ensure your design renders properly.

    By the by, does anyone know if Mail uses webkit to render email?
     
  15. Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #15
    According to Wikipedia, yes.
    Just and FYI for folks popping in, this thread was originally started in 2006 and was awoken once more at post 11, so you may want to aim responses to that individual's question. Not that the other other info provided since isn't valuable.
     
  16. macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #16
    I also would like to see the OUTBOUND email with full headers intact prior to being relayed. Meaning, redirect the output to a file or screen. Not the inbound one with all the images you get upon delivery (since it is processed by your mail server). If possible, please.

    -jim
     

Share This Page