如何使用php和html在电子邮件中发送嵌入图像 [英] how to send embed images in email using php and html

查看:212
本文介绍了如何使用php和html在电子邮件中发送嵌入图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题被问了几次,这是基本的问题,但是我在过去三天内搜索过,但是我仍然无法通过email发送图像。请帮助我如何在我的电子邮件中嵌入图像,这些标题应该包括在哪里在标题
i写下面的代码。

  $ to =example@gmail.com; 
$ subject =new account created;
$ body =新帐户已创建
< img border ='0'src ='http://www.example.com/myimages/track.php?MID = 1111& SID = 2222'width ='1'height ='1'>
;

$ headers =MIME-Version:1.0。 \r\\\
;
$ headers。=Content-type:text / html; charset = iso-8859-1。 \r\\\
;
$ headers。=From:admin@gmail.com;

$ neww = mail($ to,$ subject,$ body,$ headers);


解决方案

您无法在电子邮件中看到图片的原因大多数电子邮件阅读器都会将其删除,因为它们可用于验证有效的电子邮件地址,这是垃圾邮件发送者使用的常见策略。您的代码尖叫跟踪,这只是证明了这一点。



这个没有办法,因为图像过滤是由电子邮件客户端完成的,不能被你写的任何代码控制。


i know this question is asked several time and it is basic question but i searched last three days but i am still unable to send images in email.please help how can i embed images in my email that is which headers should i include in headers i write the following code.

 $to = "example@gmail.com";
 $subject = "new account created";
 $body = "New account has been created 
 <img border=’0' src=’http://www.example.com/myimages/track.php?MID=1111&SID=2222'  width=’1' height=’1'>
  " ;

 $headers = "MIME-Version: 1.0" . "\r\n";
 $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
 $headers .= "From: admin@gmail.com";  

 $neww=mail($to,$subject,$body,$headers);

解决方案

The reason you can't see your images in email is most email readers stript them out since they can be used for verifying valid email addresses which is a common tactic used by spammers. Your code screams tracking which only proves the point.

There is no way around this as the image filtering is done by the email clients and cannot be controlled by any code you write.

这篇关于如何使用php和html在电子邮件中发送嵌入图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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