在邮件正文中插入图片 [英] insert image in mail body

查看:305
本文介绍了在邮件正文中插入图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在用户点击发送按钮时在邮件正文中插入图片。我使用PHP邮件

解决方案

要创建HTML电子邮件,您可以这样做:

  ... 
$ message =< html>< head>< / head>< body>;
$ message。=< img src ='link-image.jpg'alt =''/>< / body>< / html>;

$ headers =From:$ from_email;
$ headers。=Content-type:text / html;

邮件($ to,$ subject,$ message,$ headers);

这应该为您建立一个HTML电子邮件,然后您应该能够插入正常的html。 / p>

编辑
您可以阅读更多关于如何使用PHP创建HTML电子邮件的信息:http://css-tricks.com/sending-nice-html-email-with-php/


How to insert image in mail body when user click on send button. I am using php mail

解决方案

To create an HTML email you can do something like this:

...
$message = "<html><head></head><body>";
$message .= "<img src='link-image.jpg' alt='' /></body></html>";

$headers = "From: $from_email";
$headers .= "Content-type: text/html";

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

This should build an HTML email for you and you should then be able to insert just normal html.

edit You can read more about how to create HTML emails using PHP from here: http://css-tricks.com/sending-nice-html-email-with-php/

这篇关于在邮件正文中插入图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆