How to embed images in email

后端 未结 6 1588
感情败类
感情败类 2020-11-22 11:57

I need to embed an image in e-mail. How do I do it?

I do not want to use third party tool, nor am I interested in language specific answer (but it is PHP, in case yo

6条回答
  •  攒了一身酷
    2020-11-22 12:42

    Here is how to get the code for an embedded image without worrying about any files or base64 statements or mimes (it's still base64, but you don't have to do anything to get it). I originally posted this same answer in this thread, but it may be valuable to repeat it in this one, too.

    To do this, you need Mozilla Thunderbird, you can fetch the html code for an image like this:

    1. Copy a bitmap to clipboard.
    2. Start a new email message.
    3. Paste the image. (don't save it as a draft!!!)
    4. Double-click on it to get to the image settings dialogue.
    5. Look for the "image location" property.
    6. Fetch the code and wrap it in an image tag, like this:

    You should end up with a string of text something like this:

    
    

    You can wrap this up into a string variable and place this absolutely anywhere that you would present an html email message - even in your email signatures. The advantage is that there are no attachments, and there are no links. (this code will display a lizard)

    A picture is worth a thousand words: enter image description here

    Incidentally, I did write a program to do all of this for you. It's called BaseImage, and it will create the image code as well as the html for you. Please don't consider this self-promotion; I'm just sharing a solution.

提交回复
热议问题