开发者

Forward Slash added in front of get parameter when using php mail function

I have a link in the body of a message that's of the form

page.php?id=x&name=y

When i send the message using php's mail function

it outputs the link (in gmail if it matters) as page.php/?id=x&name=y i.e. it puts a forward slash in front of the get parameter "id". I will eventually do URL rewrites but I'm curious as to how to prevent this from happening in PHP without doing a URL rewrite?

Thanks

EDIT:

Here's the relevant section of code:

//     $send_email and $rec_email are grabbed from database

 $part_mess = "<b>$sender_name". " says hi</b><br/><a href=profile.php?id=$sender_id&uname=$sender> View $sender_name"."'s profile</a>" ;
 $mess = $part_mess."<br/> Via <a href = 'http://www.mysite.com'>My Site</a>";
 $headers =  "MIME-Version: 1.0" . "\r\n"."Content-type:text/html;charset=iso-8859-1" . "\r\n".'From:'. $send_email . "\r\n";
 mail($rec_email, $subject,$mess,$headers , '-f 开发者_运维问答admin@name.mysite.com');


I was having the same problem, are you with 1and1.com for your hosting? For some reason only the website I had hosted with them was the mail() function escaping all special character's with forward slashes.

Try this:

//     $send_email and $rec_email are grabbed from database

 $part_mess = "<b>$sender_name". " says hi</b><br/><a href=profile.php?id=$sender_id&    uname=$sender> View $sender_name"."'s profile</a>" ;
 $mess = $part_mess."<br/> Via <a href = 'http://www.mysite.com'>My Site</a>";
 $headers =  "MIME-Version: 1.0" . "\r\n"."Content-type:text/html;charset=iso-8859-1" . "\r\n".'From:'. $send_email . "\r\n";
 mail($rec_email, $subject,stripslashes($mess),$headers , '-f admin@name.mysite.com');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜