dongting3135 2015-06-05 06:40
浏览 24

图像未在转发的邮件中显示 - php

I am using html email templates to send mail with image. and when i forward it to another mail then html template format is broken. I am using html templates in the following manner -

$message = file_get_contents('templates_folder/templatename.html');

mail($to, $from, $subject, $message);

and the image is defined in html template format is as follows -

<img src="urlofimage" />

Thanks in advance!

  • 写回答

1条回答 默认 最新

  • duanquan1876 2015-06-05 06:48
    关注

    You should build your headers for mail to make it view like a good template, else you might see only your code

    $headers = 'MIME-Version: 1.0' . "
    ";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "
    ";
    $headers .= 'To:' . "
    ";
    $headers .= 'From: Admin<youremail@email.com>' . "
    ";
    mail($to, $subject, $message, $headers);
    

    Note :

    Also make sure that the image you include should be available to public and it should not be your localhost image.

    You can also look this example

    评论

报告相同问题?

悬赏问题

  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥15 键盘指令混乱情况下的启动盘系统重装
  • ¥40 复杂的限制性的商函数处理