marmite Posted May 2, 2007 Share Posted May 2, 2007 As soon as i include dots in the address below, the mail function falls over. So I've escaped them with "/" but now the email actually prints out "www/.cardsunlimited/.com" ! Does anyone know how to get round this problem? Thanks! $message .= "www/.cardsunlimited/.com \n"; $email=$row[email_address]; mail($email, "Cards Unlimited: Forgotten Password", $message, $headers); Quote Link to comment https://forums.phpfreaks.com/topic/49630-the-mail-function-doesnt-like-dots/ Share on other sites More sharing options...
taith Posted May 2, 2007 Share Posted May 2, 2007 escapes are \... not / Quote Link to comment https://forums.phpfreaks.com/topic/49630-the-mail-function-doesnt-like-dots/#findComment-243336 Share on other sites More sharing options...
kenrbnsn Posted May 2, 2007 Share Posted May 2, 2007 What do you mean by "the mail function falls over"? Do you get errors? We need to see more of your code. Ken Quote Link to comment https://forums.phpfreaks.com/topic/49630-the-mail-function-doesnt-like-dots/#findComment-243349 Share on other sites More sharing options...
marmite Posted May 2, 2007 Author Share Posted May 2, 2007 Sorry. I think all I need is to escape the dots, but / and \ don't work. 1) If $message contains "www.cardsunlimited.com", the mail does not send. Where would I find errors? (I'm new to this. I only have access to part of the server. I have some .gz files in a log folder... but they appear to be in Chinese) 2) If $message contains "www/.cardsunlimited/.com" instead, it sends the email with "www/.cardsunlimited/.com" 3) If $message contains "www\.cardsunlimited\.com" instead, I changed this to backslashes and it sends the email as "www\.cardsunlimited\.com" Quote Link to comment https://forums.phpfreaks.com/topic/49630-the-mail-function-doesnt-like-dots/#findComment-243356 Share on other sites More sharing options...
taith Posted May 2, 2007 Share Posted May 2, 2007 then its not a matter of escaping the .'s... something else would be going on there... Quote Link to comment https://forums.phpfreaks.com/topic/49630-the-mail-function-doesnt-like-dots/#findComment-243360 Share on other sites More sharing options...
kenrbnsn Posted May 2, 2007 Share Posted May 2, 2007 As I said before, please post more of your code. Ken Quote Link to comment https://forums.phpfreaks.com/topic/49630-the-mail-function-doesnt-like-dots/#findComment-243386 Share on other sites More sharing options...
marmite Posted May 2, 2007 Author Share Posted May 2, 2007 This code works: if ($_POST['fpwd_x']) { // Check username and password $fu = $_POST['username']; $query = sprintf("SELECT * from users where username = '%s'", mysql_real_escape_string($fu)); $result = mysql_query($query) or die("Error in query " . mysql_error()); $numrows = mysql_num_rows($result); if ($numrows > 0) { $row = mysql_fetch_assoc($result); $headers = "From: Cards Unlimited Password Recovery <[email protected]>\n\r"; $message = "Dear $row[first_name], \n\n"; $message .= "Your password for Cards Unlimited is: $row[password] \n\n"; $message .= "Thank you for your custom, \n"; $message .= "The Cards Unlimited team \n"; $email=$row[email_address]; mail($email, "Cards Unlimited: Forgotten Password", $message, $headers); } else { $error = "Sorry, username does not exist"; } } This code doesn't (one line added: final $message line) if ($_POST['fpwd_x']) { // Check username and password $fu = $_POST['username']; $query = sprintf("SELECT * from users where username = '%s'", mysql_real_escape_string($fu)); $result = mysql_query($query) or die("Error in query " . mysql_error()); $numrows = mysql_num_rows($result); if ($numrows > 0) { $row = mysql_fetch_assoc($result); $headers = "From: Cards Unlimited Password Recovery <[email protected]>\n\r"; $message = "Dear $row[first_name], \n\n"; $message .= "Your password for Cards Unlimited is: $row[password] \n\n"; $message .= "Thank you for your custom, \n"; $message .= "The Cards Unlimited team \n"; $message .="www.cardsunlimited.com \n"; $email=$row[email_address]; mail($email, "Cards Unlimited: Forgotten Password", $message, $headers); } else { $error = "Sorry, username does not exist"; } } Quote Link to comment https://forums.phpfreaks.com/topic/49630-the-mail-function-doesnt-like-dots/#findComment-243390 Share on other sites More sharing options...
kenrbnsn Posted May 2, 2007 Share Posted May 2, 2007 If you change that last line to some other value, does the message get sent? It's possible the message is being caught by an overaggressive spam filter. Did you look in your spam mailbox? Ken Quote Link to comment https://forums.phpfreaks.com/topic/49630-the-mail-function-doesnt-like-dots/#findComment-243404 Share on other sites More sharing options...
marmite Posted May 2, 2007 Author Share Posted May 2, 2007 Good God! You're right, the messages are all in spam! That fixes a bunch of problems... Thank you! Is there any way to keep the link in there, but escape the spam filters? Thanks, you've saved me loads of time (and a stress-induced ulcer, I suspect). Emma Quote Link to comment https://forums.phpfreaks.com/topic/49630-the-mail-function-doesnt-like-dots/#findComment-243409 Share on other sites More sharing options...
taith Posted May 2, 2007 Share Posted May 2, 2007 yup! get a less agressive antispam program Quote Link to comment https://forums.phpfreaks.com/topic/49630-the-mail-function-doesnt-like-dots/#findComment-243412 Share on other sites More sharing options...
marmite Posted May 2, 2007 Author Share Posted May 2, 2007 Cheers...! So I was testing it on my gmail account... is it gmail's anti-spam, or is it norton (that i have installed on my home pc) that deals with this? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/49630-the-mail-function-doesnt-like-dots/#findComment-243414 Share on other sites More sharing options...
kenrbnsn Posted May 2, 2007 Share Posted May 2, 2007 You might try putting the full URL in angle brackets like this: <?php $message .= "<http://www.cardsunlimited.com/> \n"; ?> I don't know if it will help. Ken Quote Link to comment https://forums.phpfreaks.com/topic/49630-the-mail-function-doesnt-like-dots/#findComment-243417 Share on other sites More sharing options...
Daniel0 Posted May 2, 2007 Share Posted May 2, 2007 So I was testing it on my gmail account... is it gmail's anti-spam, or is it norton (that i have installed on my home pc) that deals with this? It depends on whether you are accessing it using POP or if you use Gmail's web interface. Quote Link to comment https://forums.phpfreaks.com/topic/49630-the-mail-function-doesnt-like-dots/#findComment-243425 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.