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

	//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);
				//echo ("email comfirm");

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


this is the code im using..


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

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

8 Years
Discussion Span
Last Post by network18

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.

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.

Edited by nav33n: n/a


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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.