SendMail Prob.. lil help plz :)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Gappa
Forum Contributor
Posts: 119
Joined: Fri May 23, 2003 10:02 am

SendMail Prob.. lil help plz :)

Post 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);     
?>
coreycollins
Forum Commoner
Posts: 67
Joined: Sun Feb 01, 2004 1:04 pm
Location: Michigan

Post by coreycollins »

What error messages do you get, if any.
Gappa
Forum Contributor
Posts: 119
Joined: Fri May 23, 2003 10:02 am

Post 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 :)
coreycollins
Forum Commoner
Posts: 67
Joined: Sun Feb 01, 2004 1:04 pm
Location: Michigan

Post 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" .
Last edited by coreycollins on Sun Mar 21, 2004 11:01 pm, edited 2 times in total.
Gappa
Forum Contributor
Posts: 119
Joined: Fri May 23, 2003 10:02 am

Post 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 :)
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post 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 :)
Gappa
Forum Contributor
Posts: 119
Joined: Fri May 23, 2003 10:02 am

Post 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
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post 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?
Gappa
Forum Contributor
Posts: 119
Joined: Fri May 23, 2003 10:02 am

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

?>
Gappa
Forum Contributor
Posts: 119
Joined: Fri May 23, 2003 10:02 am

Post by Gappa »

Any takers or should this be all systems go?
coreycollins
Forum Commoner
Posts: 67
Joined: Sun Feb 01, 2004 1:04 pm
Location: Michigan

Post 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.
coreycollins
Forum Commoner
Posts: 67
Joined: Sun Feb 01, 2004 1:04 pm
Location: Michigan

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