hi..

im trying to send email to the user who register to my website..

SMTP server response: 501 5.5.4 Invalid Address in D:\Domains\lelys.org\wwwroot\reg_save.php on line 66

this is the error im getting..

if($res)
{
	//echo "record added";
	//$count = 1;
	$to = $mail;
	$sub = "Confirm Mail From LeLys";
	$header = "from: LeLys<support@lelys.org>";
	
	$message = "confirm link \r\n";
	$message.= "click to activete your account \r\n";
	$message.= "http://www.lelys.org/confirmation.php?key=$ccode";
	
	$sending = mail($to,$sub,$message,$header);
	
		if($sending)
			{
				//echo ("email comfirm");
?>
		

<body>
<table width="100%" border="0" align="center" bgcolor="#DAF5FE">
  <tr>
    <td height="233"><table width="94%" border="1" align="center" bgcolor="#F0FCFF">
      <tr>
        <td height="178"><center><h2>Your Details have been Added</h2><br />Please check for a Confirmation email</center></td>
      </tr>
    </table></td>
  </tr>
</table>
<?php
}
		else
			echo("email not sent");

}

this is the code im using..

and

$sending = mail($to,$sub,$message,$header);

this is line 66 in my code.. PLZ HELP...

Well try adding the following line just before the mail function to see if the address to is being stored properly.

echo '<h1>'.$to.'</h1>';

It should display the email address and if it doesn't then your problem is that the variable $mail hasn't got any email address assigned.

i tried it..

the email id is echoed prefectly in <h1> tags...

still get the same error,,

SMTP server response: 501 5.5.4 Invalid Address in D:\Domains\lelys.org\wwwroot\reg_save.php on line 66

Well try commenting the following line and also make sure the to address is valid.

$header = "from: LeLys<support@lelys.org>";

Also, try sending a simple mail to see if it works.

<?php
mail("youraddress@domain.com","test","test mail ! Hope it works","from: youraddress@domain.com");
?>

If it does, then its obvious that you missed out something in your other script.

hi guys...

i changed the code as u said n tested it..

now im getting a different error..

Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay

wat do this thing means ?

im totally stuck wit this thing.. cant now forward with this prob..

If you tried nav33n's script and got that error first I would suggest to make sure the two email addresses in his code are not the same and are valid email addresses. If the problem continues then try contacting your web host as their SMTP server may need configuring. Also include in the email to your web host nav33n's code but with the real email addresses which do not match.

Many Internet Service Providers (ISP's) require that you send your username and password before you are allowed to send email. This is called "Authentication" or "SMTP Auth".

More recently, some ISP's have begun to require that you have TWO separate and different login names - one for checking mail and one for sending mail. This is called "SMTP Relay".
So there might be the problem with your smtp server settings, check with it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.