Search code examples
phpemail

Sending images through php mail function


I have a problem sending images through the PHP mail function.

I have used tiny MCE as a text editor for the mail body and pasted some images into the body and some text.

All content with images is displayed as posted data but when I passed it to mail() function only the text is sent to the mail address.

I have set the mime version and also the content type to text/HTML in the header. I don't get what is the actual problem with sending images as content to the mail body.


Solution

  • Please check the image path you have in your editor. The image path should be something like

    Http://www.yoursite.com/images/uploads/image.jpg
    

    if it is like

    ../../../images/uploads/image.jpg
    

    it won't work in emails. Try to provide the complete image location.