mail not working?!!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
saumya
Forum Contributor
Posts: 193
Joined: Sun Jan 30, 2005 10:21 pm

mail not working?!!

Post 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.";
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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?
saumya
Forum Contributor
Posts: 193
Joined: Sun Jan 30, 2005 10:21 pm

Post 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.
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post by miro_igov »

You can try using some valid email for the $from value.
saumya
Forum Contributor
Posts: 193
Joined: Sun Jan 30, 2005 10:21 pm

Post 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 !!
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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.
Post Reply