Page 1 of 1

mail not working?!!

Posted: Sat Mar 24, 2007 12:18 am
by saumya
hi,
I have a simple script as below, trying to check mail() function of PHP.BUt the script says mail has sent, while its not sending the mail actually. :(

Code: Select all

$uName='sam';
	$to = "2saumyaray@gmail.com";
	    $from = 'what';
	    $subject = "site feed back";
	    $message =  'message';
	    $headers  = "From: $from\r\n";
	    $success = mail($to, $subject, $message, $headers);
	    if ($success)
		   echo('msg=Your message has been sent successfully.');
	    else
		echo "msg=An error occurred when sending the email.";

Posted: Sat Mar 24, 2007 1:13 am
by feyd
The positive return value from mail() only means that it was put in the output queue and should be sent. It cannot guarantee that the receiving server accepts it.

Gmail, like many other mail services greatly filters the incoming mail. Your email probably fell prey to one or more filters.

Have you taken a look at the threads concerning Swift?

Posted: Sat Mar 24, 2007 1:25 am
by saumya
Hi feyd,
thank you for the input.
I am hearing "swift" for the first time.Let me search for it too.
I will change the server name from gmail to some other service and check it too.

Posted: Sat Mar 24, 2007 3:37 am
by miro_igov
You can try using some valid email for the $from value.

Posted: Sat Mar 24, 2007 7:22 am
by saumya
hi miro_igov,
I have tried with below code

Code: Select all

$uName='sam';
$to = "2saumyaray@gmail.com";
$from = 'r.saumya@yahoo.com';
$subject = "site feed back";
$message =  'message';
$headers  = "From: $from\r\n";

$config = "-fwebmaster@mycompany.com";

$success = mail($to, $subject, $message, $headers,$config);
if ($success)
	echo('msg=Your message has been sent successfully.');
else
	echo "msg=An error occurred when sending the email.";
but result is the same.I get the confirmation message, but no mail !!

Posted: Sat Mar 24, 2007 12:24 pm
by John Cartwright
Like feyd mentioned, your emails are probably being caught in the spam filters. Malformed or incomplete headers are typicallly a sure sign that it will not make it to the destination inbox. Do yourself a favor and try Swift, it is so easy to implement and you'll be firing emails within a couple minutes.