NameSilo

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.
please post the code again, it is a syntax error now.
 
0
•••
hi,

it all here.

<?

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");

?>
 
0
•••
0
•••
PHP:
<?

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

//Move to vars, easier to work with.
$ListingID = intval($_GET['ListingID']);
$AgentID = intval($_GET['AgentID']);

$q1 = mysql_query("SELECT * FROM re2_agents WHERE AgentID = ".$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='.$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='.$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'];

/*
Here is where the error occured, in what I originally posted it 
was because I forgot that:

"empty() only checks variables as anything else will result in a 
parse error. In other words, the following will not work: 
empty(trim($name))."
*/
if(!empty($ListingID))
{
  $SubjectLine = "Property ID ".$ListingID;
}

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

?>
 
0
•••
hi,

done excatly like you suggested but still no joy.

when i click send "error" comes up in the left side, though something strange happens.

a thank you message comes up and the form box aswell.

have a look

http://www.cheap-florida-holiday.com/email.php

also no emails are comming through.

what should i try?

cheers i am thankful for all suggestions!
 
0
•••
When I "sent" email via your form, there was no "listing_id" or "agent_id" in the querystring, so if there isn't then the variables that are defined by using "$_GET['listingID']" etc... won't be there, and therefore it cant search the database for that agent id because there isn't one there to search with.

There are two ways to check for this: both done in code below:

PHP:
<? 

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

//Move to vars, easier to work with. 
$ListingID = intval($_GET['ListingID']); 
$AgentID = intval($_GET['AgentID']); 

$q1 = mysql_query("SELECT * FROM re2_agents WHERE AgentID = ".$AgentID) or die(mysql_error());
//
// THIS IS THE FIRST ERROR CHECK
// IF AGENT ID IS EMPTY THERE WILL
// BE NO ROWS RETURNED
//
if(mysql_num_rows($q1)<1){
  echo "no rows returned...";
}
// --
$a1 = mysql_fetch_array($q1); 

if(isset($_POST['s1'])) 
{ 
  $to = $a1['email']; 
  //
  // SECOND WAY TO TEST...
  // SEE IF to VAR IS
  // EMPTY OR NOT
  //
  if(empty($to)){
    echo "no email address to send to...";
  }
  // --
  $subject = $_POST['subject']; 
  $message = $_POST['message']; 
  $message .= 'Property:'."\n".$site_url.'/info.php?id='.$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='.$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']; 

/* 
Here is where the error occured, in what I originally posted it  
was because I forgot that: 

"empty() only checks variables as anything else will result in a  
parse error. In other words, the following will not work:  
empty(trim($name))." 
*/ 
if(!empty($ListingID)) 
{ 
  $SubjectLine = "Property ID ".$ListingID; 
} 

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

?>
see what that turns up
 
0
•••
hi,
it says

no rows returned...no email address to send to...error
 
0
•••
fried-chicken said:
hi,
it says

no rows returned...no email address to send to...error
Hmm... change
PHP:
//Move to vars, easier to work with.
$ListingID = intval($_GET['ListingID']);
$AgentID = intval($_GET['AgentID']);
to
PHP:
//Move to vars, easier to work with.
$ListingID = intval($_GET['ListingID']);
$AgentID = intval($_GET['AgentID']);

echo $ListingID . ' ' . $AgentID . '<br />';
and run it.. post what it says here.
 
0
•••
the problem is that it isn't getting anything from the database. This is because you aren't sending a listingid and a agentid to the script. Is there an agent in your database? if there is, in the html with the form in it so this:

<form method="post" action="emailscript.php?AgentID=#an agent id here that is in your database#&ListingID=#a listing id here that is in your database#">

that will send an agent Id and a listing Id to the script as well.
 
0
•••
thanks for everyone who tried to help me out.

just figured what the problem was.

the contact page can only be used by people who are signed in.

simple problem. i'll just put a formtomail cgi script on it.

thanks again for all the help.
 
0
•••
hmm.. ok - simple explination.

Hope it all works out for you.
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back