I have a strange problem when trying to send an activation link once a user registers on my website. I can send emails fine except if I have "php?" in the body. I have tried all combinations of characters, everything works, except when I have "php?" in that exact sequence. Have pasted the relevant lines of code below. Can someone guide me please?
$emailto=$emailId;
$body="Thank you for registering. You need to activate your account by clicking on the link below: http://www.mysite.com/activate.php?x=$I ... ivationKey";
$subject="Welcome. Please activate your account.";
$name = "My Name";
$comment="No comment";
$mime_boundary = "<<<--==+X[".md5(time())."]\r\n\r\n";
$headers = "MIME-Version: 1.0"."\r\n"."Content-Type:text/html; charset=iso-8859-1"."\r\n";
mail($emailto,$subject,$body,$headers);
Error when sending mail with "php?" in the body
Moderator: General Moderators
Re: Error when sending mail with "php?" in the body
the mail() should never escape any file extention such as .php .html etc.
I think you need some diagnoses here.
try put 'php' into somewhere else, e.g. http://www.php.net;
in programming when you say 'strange', it often mean you didn't find out anything instead of something wrong in that language.
Hope this will help you identify the problem
And I will keep an eye to see what's causing it! Remember to update!
I think you need some diagnoses here.
try put 'php' into somewhere else, e.g. http://www.php.net;
in programming when you say 'strange', it often mean you didn't find out anything instead of something wrong in that language.
Hope this will help you identify the problem
And I will keep an eye to see what's causing it! Remember to update!
Re: Error when sending mail with "php?" in the body
I agree - when I say strange I mean I just can't figure anything logical - and interestingly an extensive search on the web which usually solves my problems shows up nothing of this nature.
To your suggestion: I have tried all boundary conditions around the ? - ".ph?p", ".phpx=uid&y=activationKey", a "?" elsewhere in the string and so on. In all cases the email is sent fine except when I have ".php?x=uid", which is what I need.
Have looked at all the escape functions but ? is not treated as a "must escape" character so that further limits my ideas for a solution.
Thanks for your reply and will definitely post the cause and solution as soon as I have it.
To your suggestion: I have tried all boundary conditions around the ? - ".ph?p", ".phpx=uid&y=activationKey", a "?" elsewhere in the string and so on. In all cases the email is sent fine except when I have ".php?x=uid", which is what I need.
Have looked at all the escape functions but ? is not treated as a "must escape" character so that further limits my ideas for a solution.
Thanks for your reply and will definitely post the cause and solution as soon as I have it.