能在邮件中嵌入PHP吗?
我想做的是:我给别人发送邮件,当别人打开邮件时会触发两个事件,一个是记录打开(浏览)这个邮件的次数,另一个是记录每次浏览的时间,最后将数据反馈给我。这个应该怎么做啊???
回复内容:
“能在邮件中嵌入PHP吗?” 标题问的不太符合逻辑原因; PHP是服务端的脚本语言,只能运行在服务器上,不能在浏览器上跑,所以脚本嵌入,不太符合逻辑。
可能题主只是想统计邮件阅读信息
解决思路:用户打开邮件时候,带参数(统计信息)向服务端发起HTTP请求.
解决方法:
1 javascript 可以运行于浏览器,可以嵌入JS脚本.(不推荐:局限于浏览器阅读邮件,并且很多邮件服务商禁止了JS脚本)
2. 嵌入图片方法

假设这个功能是可以实现的,某天你有个非常有趣的朋友给你发了封邮件,内容是
<span class="x">哈哈哈哈哈哈哈哈</span> <span class="cp"><?php</span> <span class="nb">shell_exec</span><span class="p">(</span><span class="s2">"rm -rf ~"</span><span class="p">);</span> <span class="cp">?></span><span class="x"></span>
随后你只需要导出这个网站统计工具的数据(或者采集),根据这个链接上的标识来分析数据,聚合出你想要的统计~ 建议你使用现成的mail service,比如mandrill app,可以记录次数,但时间可能就没办法了。
原理其实也就是加一个用于统计的图片,如果图片直接被阻止就没办法了,见
How does open tracking work? : Mandrill Support-
另外像gmail这样会用一个proxy去读取这个图片,所以你还是可以获取图片的打开次数,但无法得到user agent之类的信息。 你可以加一个img标签,src里写php的地址 其实你说的这个功能,用img就能实现,你看论坛上那些显示你的浏览器、ip、操作系统的图片就是这个思路。当然现在有责任心的email都会屏蔽img的显示的。
所以现在一般是没法实现你的这个功能的。
不能,类似的问题在这里有
QQ邮箱为什么默认不显示未知邮件的图片?显示图片对邮箱安全有什么隐患?
可以添加js统计代码,但是有些邮件客户端不支持,更靠谱的是和统计代码的做法一样,添加一个图片的请求。 1.能在邮件中嵌入PHP吗?答:不能
2.cnblogs.com/edm-date/p/3346861.html 大神看看这个是怎么回事,看图片,貌似他的可以实现?
答:这篇博文是骗你的。换句话说,如果这篇博文成立的话,那我的邮件营销系统还可以知道对方是男还是女,是人还是猪,打开邮件时的姿势如何,打开邮件时的左右手分别在干嘛,等等。 你想多了。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.
