每当我通过PHP发送邮件(由jQuery生成的内容,AJAX POST
发送到PHP)时,到达目的地时URL的底部会丢失。当通过PHP发送邮件时,链接URL基本消失
因此,举例来说,我发邮件用了以下机身:
Click <a href="http://www.example.com/?u=parameter&i=otherparameter">HERE</a> to go to the login page, etc, etc..
Use this link or copy it to your browser's address bar if the above doesn't work:
<a href="http://www.example.com/?u=parameter&i=otherparameter">http://www.example.com/?u=parameter&i=otherparameter</a>
,看起来像这样:
点击HERE去到登录页面,等等,等等。
如果以上不起作用,请使用此链接或将其复制到浏览器的地址栏中: http://www.example.com/?u=parameter&i=otherparameter
但,接收端收到的相同文字,只是没了联系基地网址..
的Click HERE
链路具有唯一/?u=parameter&i=otherparameter
的URL,这同样适用于其他链接,但该链接的文字很好。所以它进入邮件打开的页面并在那里添加参数。它看起来像这样:
点击HERE去到登录页面,等等,等等。
使用此链接或将其复制到浏览器的地址栏,如果上述方法无效: http://www.example.com/?u=parameter&i=otherparameter
正如您所看到的,该链接将被定向到stackoverflow.com
而不是example.com
。发生什么事情,无论是jQuery,AJAX或PHP剥离我的HTML,还是客户端问题?
(经测试,在FF15/Chrome20/IE8,jQuery的V1.7.2,PHP v5.3.5)
编辑
这是我如何发送邮件使用PHP:
$to = $_POST['t'];
$subject = $_POST['s'];
$message = $_POST['m'];
$headers = "MIME-Version: 1.0" . "\r\n" .
"Content-type: text/html; charset=iso-8859-1" . "\r\n" .
"From: <[email protected]>" . "\r\n" .
"X-Mailer: PHP/" . phpversion();
mail($to, $subject, $message, $headers);
你怎么样在发送之前知道身体是什么样的?在发送给'mail()'之前,你检查过'$ message'的值了吗?您是否使用过Chrome或Firefox的开发工具来查看发送到服务器的内容? – rexmac
你检查过htaccess文件吗?也许它已被设置在htaccess重定向文件 – bungdito