Jump to content

The mail() function doesn't like dots


marmite

Recommended Posts

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);

Link to comment
Share on other sites

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"

Link to comment
Share on other sites

 

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 <passwords@cardsunlimited.com>\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 <passwords@cardsunlimited.com>\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";
}
}

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.