Page 1 of 1

SendMail Prob.. lil help plz :)

Posted: Sun Mar 21, 2004 10:25 pm
by Gappa
Hey Im trying to get a sendmail fuction to work, but it isnt happening it pulls the information from a flash form.

Here is my code:

Code: Select all

<?  
     $adminaddress = "gappamurphy@hotmail.com";
     $siteaddress ="http://www.romheldaustralia.com.au"; 
     $sitename = "Romheld Australia"; 
     $date = date("d/m/Y H:i:s");
      
      if ($REMOTE_ADDR == "") 
          {
               $ip = "no ip";
          }
     else 
          {
               $ip = getHostByAddr($REMOTE_ADDR);
          }

     mail("$adminaddress","Message sent via http://www.romheldaustralia.com.au", 
          "Name: ". $inputName.
	  "Address: ". $inputAddress. 
          "Town/Suburb: ". $inputSuburb.
          "State: ". $inputState.
          "Postcode: ". $inputPostcode.
          "Telephone: ". $inputTelephone.
          "Email: ". $inputEmail. 
          "Comment: ". $inputComment.
          "------------------------------"
          "Catalouge 22"
          "------------------------------
          Logged Info :
          Using: ". $HTTP_USER_AGENT.
          "Hostname: ". $ip.
          "IP address: ". $REMOTE_ADDR.
          "Date/Time: ". $date.
          "FROM: " .$adminaddress"); 

     mail($vemail,
          "Thank You for visiting " .$sitename. ".  Your email has been recieved and will be processed shortly.",
          "FROM: ".$adminaddress);     
?>

Posted: Sun Mar 21, 2004 10:41 pm
by coreycollins
What error messages do you get, if any.

Posted: Sun Mar 21, 2004 10:50 pm
by Gappa
Parse error: parse error in /data/hosted/Gappa/sendmail.php on line 26


Which i think is

Code: Select all

<?php
"Catalouge 22"
?>
There may be more... its not sending the email atl all i guess it is because it has errors...

I'll post the action script from the flash form if required also.

Cheers :)

Posted: Sun Mar 21, 2004 10:57 pm
by coreycollins
ok I think I see your problem. You're missing 2 dots.
The ones you missed are on the lines

Code: Select all

"------------------------------".
//and

 "Catalouge 22" .

Posted: Sun Mar 21, 2004 11:00 pm
by Gappa
Cool thanks that and killing a " made the errors go away hopefully it will now send... if not I'll be back haha

Thanks again :)

Posted: Sun Mar 21, 2004 11:02 pm
by Steveo31
coreycollins wrote:ok I think I see your problem. You're missing a dot.
The one you missed is on the line

Code: Select all

"------------------------------".
Yup. If you notice the rest of the post after that, the quotations are all messed up. The stuff that is supposed to be in quotes isn't.

Code: Select all

<?php
..."
"-------------------------"
     mail($vemail,
          "Thank You for visiting " .$sitename. ".  Your email has been recieved and will be processed shortly.",
          "FROM: ".$adminaddress);     
?>


Edit- beat me to it :)

Posted: Sun Mar 21, 2004 11:14 pm
by Gappa
hehe... ok well isnt getting errors... but it don't seem to be seem to be sending nothing no where...

Code: Select all

<?  
     $adminaddress = "gappamurphy@hotmail.com";
     $siteaddress ="http://www.romheldaustralia.com.au"; 
     $sitename = "Romheld Australia"; 
     $date = date("d/m/Y H:i:s");
      
      if ($REMOTE_ADDR == "") 
          {
               $ip = "no ip";
          }
     else 
          {
               $ip = getHostByAddr($REMOTE_ADDR);
          }

     mail("$adminaddress","Message sent via http://www.romheldaustralia.com.au", 
"Name: ". $inputName. 
"Address: ". $inputAddress. 
"Town/Suburb: ". $inputSuburb. 
"State: ". $inputState. 
"Postcode: ". $inputPostcode. 
"Telephone: ". $inputTelephone. 
"Email: ". $inputEmail. 
"Comment: ". $inputComment. 
"------------------------------". 
"Catalouge 22 
------------------------------ 
Logged Info : 
Using: ". $HTTP_USER_AGENT. 
"Hostname: ". $ip. 
"IP address: ". $REMOTE_ADDR. 
"Date/Time: ". $date. 
"FROM: " .$adminaddress); 

mail($vemail, 
"Thank You for visiting " .$sitename. ". Your email has been recieved and will be processed shortly.", 
"FROM: ".$adminaddress);
    
?>
Any idea why :S

Posted: Sun Mar 21, 2004 11:49 pm
by Steveo31
Each of the variables... I believe they have to be declared as $_POST variables, like so:

Code: Select all

<?php

...

"Name: ". $_POST['inputName'].
"Address: ". $_POST['inputAddress'].
"Town/Suburb: ". $_POST['inputSuburb'].

//so on...

?>
I may just be really tired, but where is "vemail" defined?

Posted: Mon Mar 22, 2004 12:22 am
by Gappa
Hmm ok this is how it is looking now... still doesnt seem to send an email

Anything wrong with my mail function?

Code: Select all

<?  
     $adminaddress = "gappamurphy@hotmail.com";
     $siteaddress ="http://www.romheldaustralia.com.au"; 
     $sitename = "Romheld Australia"; 
     $date = date("d/m/Y H:i:s");
     $vemail = $_POST['inputEmail'];
 
      if ($REMOTE_ADDR == "") 
          {
               $ip = "no ip";
          }
     else 
          {
               $ip = getHostByAddr($REMOTE_ADDR);
          }

     mail($adminaddress,"Message sent via http://www.romheldaustralia.com.au", 
"Name: ". $_POST['inputName'].  
"Address: ". $_POST['inputAddress']. 
"Town/Suburb: ". $_POST['inputSuburb']. 
"State: ". $_POST['inputState']. 
"Postcode: ". $_POST['inputPostcode']. 
"Telephone: ". $_POST['inputTelephone']. 
"Email: ". $_POST['inputEmail']. 
"Comment: ". $_POST['inputComment']. 
"------------------------------". 
"Catalouge 22 
------------------------------ 
Logged Info : 
Using: ". $HTTP_USER_AGENT. 
"Hostname: ". $ip. 
"IP address: ". $REMOTE_ADDR. 
"Date/Time: ". $date. 
"FROM: " .$adminaddress); 

mail($vemail, 
"Thank You for visiting " .$sitename. ". Your email has been recieved and will be processed shortly.", 
"FROM: ".$adminaddress);
    

?>

Posted: Mon Mar 22, 2004 6:11 am
by Gappa
Any takers or should this be all systems go?

Posted: Mon Mar 22, 2004 7:37 am
by coreycollins
I see a small error but not one that would stop the email from being sent. On the lines:

Code: Select all

"Date/Time: ". $date.
"FROM: " .$adminaddress);
You want a comma seperating date and "FROM, not a dot. FROM should be in the additional hearders field not in the email message.

Posted: Mon Mar 22, 2004 7:39 am
by coreycollins
I don't know if this will display a good error message but you could try putting a

Code: Select all

or die(mysql_error())
after the mail function to see what's going on with the mail function.