Dynadot

Np$ 50 for resolving issue.

Spaceship Spaceship
Watch
keep getting this error message:


Warning: mail(): SMTP server response: 554 Error: no valid recipients in e:\domains\c\cheap-florida-holiday.com\user\htdocs\email.php on line 25


anyone help me?
Np$ 50 for resolving issue.

cheers
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Im ready to help, can you please paste the document code? thanks
 
0
•••
the problem is this is a .php page that calls three other .php pages.

so not quite sure what page to paste.

what do you think?
 
0
•••
pls paste this page: e:\domains\c\cheap-florida-holiday.com\user\htdocs\email.php

i see whats on line 25
 
0
•••
Can u send me the email.php , the error code seem like authentication issue. my email is [email protected]
 
0
•••
hi, ths is the email.php

<?
require_once("conn.php");
require_once("includes.php");

//get the agent info
$q1 = "select * from re2_agents where AgentID = '$_GET[AgentID]' ";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);

if(isset($_POST[s1]))
{
$to = $a1;
$subject = $_POST[subject];
$message = $_POST[message];
$message .= "\n\nProperty:\n$site_url/info.php?id=$_GET[ListingID]\n\n";

$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$headers .= "From: $_POST[u_name] <$_POST[u_email]>\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: PHP/" . phpversion()."\n";

mail($to, $subject, $message, $headers);

$thankyou = "<center><b><br><br><br>Thank you for your message!<br><br><a class=RedLink href=\"$site_url/info.php?id=$_GET[ListingID]\">back to the property details</a></center>";


//get the templates
require_once("templates/HeaderTemplate.php");
require_once("templates/EmailThankyouTemplate.php");
require_once("templates/FooterTemplate.php");

}


$AgentName = "$a1[FirstName] $a1[LastName]";

if(!empty($_GET[ListingID]))
{
$SubjectLine = "Property ID $_GET[ListingID]";
}


//get the templates
require_once("templates/HeaderTemplate.php");
require_once("templates/EmailTemplate.php");
require_once("templates/FooterTemplate.php");

?>

this is the emailtemplate.php what the above code request.

<script>
function CheckMail() {

if(document.je.u_name.value=="")
{
alert('Enter your name, please!');
document.je.u_name.focus();
return false;
}

if(document.je.u_email.value=="")
{
alert('Enter your email, please!');
document.je.u_email.focus();
return false;
}

if(document.je.subject.value=="")
{
alert('Enter the subject, please!');
document.je.subject.focus();
return false;
}

if(document.je.message.value=="")
{
alert('Enter your message, please!');
document.je.message.focus();
return false;
}

}
</script>

<br><br>
<form method=post onsubmit="return CheckMail();" name=je>
<table width=340 align=center border=0>
<caption align=center><span style="font-size:11; font-family:verdana; color:black; font-weight:bold">Use this form to contact <?=$AgentName?></span></caption>

<tr>
<td>Name:</td>
<td><input type=text name="u_name" size=42 class="mtext"></td>
</tr>

<tr>
<td>Email:</td>
<td><input type=text name=u_email size=42 class="mtext"></td>
</tr>

<tr>
<td>Subject:</td>
<td><input type=text name=subject size=42 class="mtext" value="<?=$SubjectLine?>"></td>
</tr>

<tr>
<td valign=top>Message:</td>
<td><textarea rows=6 cols=41 name=message class="mtext"><?=$_POST[message]?></textarea></td>
</tr>

<tr>
<td> </td>

<td>
<input type=submit name=s1 value="Send" class="sub1">
</td>
</tr>

</table>
</form>
 
Last edited:
0
•••
it is possible that the email is not valid. Try echoing out $q1, and put it into phpmyadmin to see if anything gets returned. If nothing gets returned, it's your query's problem, and not the mail code or anything.
 
0
•••
yeah i'll give it a go.

any chance you can explain clearer, never touch script codes before.

cheers
 
0
•••
ok, never mind, let me try a different approach. After $a1 = mysql_fetch_array($r1);, but echo $a1; if it returns a blank, there's a problem with your query. if it returns an email, I'll have to think a little bit longer. is this ok with you?
 
0
•••
Most likely the E-mail you are trying to send to is not set/invalid.
Echo it to check.
Also use quotes when accessing array elements:

$to = $a1; => $to = $a1["email"];
 
0
•••
^ yes, I was also about to suggest that. I normally use single quotes though, ' .
 
0
•••
EDITED like suggestions no joy.
did i put it in the right place?

-------------------------------

<?
require_once("conn.php");
require_once("includes.php");

//get the agent info
$q1 = "select * from re2_agents where AgentID = '$_GET[AgentID]' ";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);

echo $a1;

if(isset($_POST[s1]))
{
$to = $a1[email];
$subject = $_POST[subject];
$message = $_POST[message];
$message .= "\n\nProperty:\n$site_url/info.php?id=$_GET[ListingID]\n\n";

$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$headers .= "From: $_POST[u_name] <$_POST[u_email]>\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: PHP/" . phpversion()."\n";

mail($to, $subject, $message, $headers);

$thankyou = "<center><b><br><br><br>Thank you for your message!<br><br><a class=RedLink href=\"$site_url/info.php?id=$_GET[ListingID]\">back to the property details</a></center>";

-----------------


tried with and with out " " and ' ' around [mail]
 
0
•••
did you do '[mail]' or ['mail']?

o yea, and what did it output? anything new?
 
0
•••
hi i did

['mail']

it change to

Warning: mail(): SMTP server response: 554 Error: no valid recipients in e:\domains\c\cheap-florida-holiday.com\user\htdocs\email.php on line 27


the line error moved dome to line 27
 
0
•••
ok, yea, that didn't change...

just to make sure, comment out the line that says mail($to, ...etc...). just put // in front of it, and change echo $a1; to echo $a1['email'].
 
0
•••
fried-chicken said:
EDITED like suggestions no joy.
did i put it in the right place?

It did nothing??? it didn't echo anything?

where you have
PHP:
echo $a1[email];

change it to:
PHP:
if(!isset($a1['email']) || empty($a1['email'])){
  echo "something wrong";
}
else{
  echo $a1['email'];
}

run the script and tell us what it says now
 
0
•••
hi, done the changes you both said.

the change suggested by "poordoogie"

------------------------------------------

now as soon as you go on to the contacts page it reads "something wrong" in the top right hand corner. without trying to use the formtomail. once used it come up with a similar error as before.

the change suggested by "anzchong91"

---------------------------------------

gives "Parse error: parse error, unexpected T_IF, expecting ',' or ';' in e:\domains\c\cheap-florida-holiday.com\user\htdocs\email.php on line 13"
by going to the contact page and not trying to use the formtomail. nothing else loads on the page.

script still on "anzchong91" suggestion, result can be seen at

www.cheap-florida-holiday.com/email.php
 
0
•••
PHP:
<?
require_once("conn.php");
require_once("includes.php");

$q1 = "SELECT * FROM `re2_agents` WHERE `AgentID` = '".$_GET['AgentID']."' ";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);

if(isset($_POST['s1'])){
	$to = $a1['email'];
	$subject = $_POST['subject'];
	$message = $_POST[message];
	$message .= "Property:\n".$site_url."/info.php?id=".$_GET['ListingID']."\n\n";

	$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
	$headers .= "Content-Transfer-Encoding: 8bit\n";
	$headers .= "From: ".$_POST['u_name']." <".$_POST['u_email'].">\n";

	if(!@mail($to, $subject, $message, $headers)){
		echo "error";
	}

	$thankyou = "<center><b><br><br><br>Thank you for your message!<br><br><a class=RedLink href=\"$site_url/info.php?id=$_GET[ListingID]\">back to the property details</a></center>";
	
	require_once("templates/HeaderTemplate.php");
	require_once("templates/EmailThankyouTemplate.php");
	require_once("templates/FooterTemplate.php");
}
$AgentName = $a1['FirstName']." ".$a1['LastName'];
if(!empty($_GET[ListingID])){
	$SubjectLine = "Property ID ".$_GET['ListingID'];
}
require_once("templates/HeaderTemplate.php");
require_once("templates/EmailTemplate.php");
require_once("templates/FooterTemplate.php");

?>
 
0
•••
hi,
cvxdes. just tried your suggestion. the page loads fine, but when you presss send in the form a small " error " comes up in the top left corner.

cheers
 
0
•••
are you sure your server is properly configured to send mail?

ps: what does the "@" sign before the mail() function do?
 
0
•••
PoorDoggie said:
ps: what does the "@" sign before the mail() function do?
@ in front of a PHP function supress any error returned by the function.
 
0
•••
Made a few changes:
PHP:
<?

require_once("conn.php");
require_once("includes.php");

$q1 = mysql_query("SELECT * FROM re2_agents WHERE AgentID = '".intval($_GET['AgentID'])."'") or die(mysql_error());
$a1 = mysql_fetch_array($q1);

if(isset($_POST['s1']))
{
  $to = $a1['email'];
  $subject = $_POST['subject'];
  $message = $_POST['message'];
  $message .= 'Property:'."\n".$site_url.'/info.php?id='.intval($_GET['ListingID'])."\n\n";

  $headers .= 'Content-type: text/plain; charset=iso-8859-1'."\r\n";
  $headers .= 'Content-Transfer-Encoding: 8bit'."\r\n";
  $headers .= 'From: '.$_POST['u_name'].' <'.$_POST['u_email'].'>'."\r\n";

  if(!@mail($to, $subject, $message, $headers))
  {
    echo "error";
  }
  $thankyou = '<center><b><br><br><br>Thank you for your message!<br><br><a class=RedLink href="'.$site_url.'/info.php?id='.intval($_GET['ListingID']).'">back to the property details</a></center>';

  require_once("templates/HeaderTemplate.php");
  require_once("templates/EmailThankyouTemplate.php");
  require_once("templates/FooterTemplate.php");
}

$AgentName = $a1['FirstName'].' '.$a1['LastName'];

if(!empty(intval($_GET['ListingID'])))
{
  $SubjectLine = "Property ID ".intval($_GET['ListingID']);
}

require_once("templates/HeaderTemplate.php");
require_once("templates/EmailTemplate.php");
require_once("templates/FooterTemplate.php");

?>
I'll also point out, you might want to implement some input validation. ;)
 
0
•••
Constantin said:
@ in front of a PHP function supress any error returned by the function.
oh right :) so if I were to do @mysql_query($sql) it wouldn't come up with lines of unintelligible text about me having an "error in [my] mysql syntax"?

Great, thanks.

Back to the thread
Tom
 
0
•••
i keep getting this error now on page load.

Parse error: parse error, unexpected T_STRING, expecting T_VARIABLE or '$' in e:\domains\c\cheap-florida-holiday.com\user\htdocs\email.php on line 33
 
0
•••
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back