我最近了解到,网络邮箱,如Gmail会做改变HTML电子邮件,例如添加target="_blank"到<a>标签.
我还发现其他改动也会发生.当我从PHP脚本向Gmail(可能还有其他Web邮件客户端)发送HTML电子邮件时,任何链接的URL中包含的变量值都将被删除.因此,例如,这是我在PHP代码中设置的值:
$mailContent = '<p><a target="_blank" href="https://example.com/confirmation.html?verification=x1x1x1x1x1x1x1x&email=yyyy@email.com">click here to go to the web site and activate your account!</a></p>';
Run Code Online (Sandbox Code Playgroud)
但是,当在Gmail中收到电子邮件时,HTML代码如下所示:
<p><a target="_blank" href="https://example.com/confirmation.html?verification=&email=">click here to go to the web site and activate your account!</a></p>
Run Code Online (Sandbox Code Playgroud)
值x1x1x1x1x1x1x1x和yyyy@email.com已经从内部剥离出来<a>的标签.
如何保护我要传递给URL的变量值,以便Gmail不会删除它们?