How to add image to php mail body

前端 未结 2 415
[愿得一人]
[愿得一人] 2021-01-21 20:52

I\'m trying to add image to mail body from folder.but it not display only display text on alt tag.this is my code.



        
相关标签:
2条回答
  • 2021-01-21 21:30

    You can either link to a fully qualified URL of the image, e.g. http://yourserver.com/images/image.png

    Or, you can embed the image in your email using MIME. See this response: PHP Attaching an image to an email

    You may choose whichever you want, still it is not guaranteed that the image will be displayed by the mail client - in most cases, the client decides whether it will or will not show the images.

    0 讨论(0)
  • 2021-01-21 21:38

    This should work as expected:

    <?php 
        ...
        $body .= '<img src="http://domain.com/absolute/path/to/image/img/logo.png" alt="Hotel" /><br/>';
        ...
    ?>
    
    0 讨论(0)
提交回复
热议问题