HELP!

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
Jensen
Forum Newbie
Posts: 6
Joined: Sun May 05, 2002 11:30 pm

HELP!

Post by Jensen »

Hello Girls + Boys , I Need help On Form To Mail , The Problem Is I Have No Brains About It ... I Would Like Some Sort Of Script That Will Allow Me To Use SMTP Servers ... Would Be GREAT 8O , Any Ideas
Http://www.doomtfc.2y.net/new/poll/ <----- where it says contact us i would like a script on there
PLEASE HELP ME!
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

Code: Select all

<?
if($name == "" || $comment == "") &#123;

   print('<html><head><title>error</title></head>');
   print('<body>Please make sure to fill in all fields...go back and try again.');
   print('</body></html>');
     
     &#125; 
	 
	 else 
  &#123;
  
  $main_message = "";
  $name = '';
  $comment = '';
  $REMOTE_ADDR = ";
  
  $email_2 = "YOUR_EMAIL_ADRESS_GOES_HERE";
   
  mail($email_2, $subject,$main_message,"From:$name");
  echo "<html><body>Sent</body></html>";
  &#125;

?>
then just make sure your fields are titled "name" and "comment", and also make sure the action of the form points to the file containing that code, also make sure to edit where it says your email adress goes here :wink:
Jensen
Forum Newbie
Posts: 6
Joined: Sun May 05, 2002 11:30 pm

Post by Jensen »

erm ok help .. i am a n00b
Jensen
Forum Newbie
Posts: 6
Joined: Sun May 05, 2002 11:30 pm

Post by Jensen »

wat i meen is .. will it use the sendmail .. or wat
Jensen
Forum Newbie
Posts: 6
Joined: Sun May 05, 2002 11:30 pm

Post by Jensen »

i get a error in line 16
User avatar
pHaZed
Forum Commoner
Posts: 28
Joined: Wed May 01, 2002 2:44 am
Location: Sydney -AU

SMTP servers...

Post by pHaZed »

Some Sort Of Script That Will Allow Me To Use SMTP Servers
There is a built in function is PHP, It uses the servers mail application (eg sendmail on unix).
u can use it like this

Code: Select all

mail($to_addy, $subject, $body, "From:you@domain.net");
Where $to_addy, Is the form or variable that contains the string that is to be the email address to send to,
$subject is the subject....
and $body is the main message.
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Code: Select all

$REMOTE_ADDR = ";
should be changed to

Code: Select all

$REMOTE_ADDR = "";
Image Image
Jensen
Forum Newbie
Posts: 6
Joined: Sun May 05, 2002 11:30 pm

Post by Jensen »

phice wrote:

Code: Select all

$REMOTE_ADDR = ";
should be changed to

Code: Select all

$REMOTE_ADDR = "";
Done that ! , lol but now i get this error even when i type a message Please make sure to fill in all fields...go back and try aga
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

ok on your page it needs to be like

<form action="sendmail.php">
<input type=text name="name" value="Name"><br>
<input type=text name="comment" value="Comment"><br>
<input type=submit name=submit value="Submit">
</form>

and then you need to have the script i gave you in a file called sendmail.php ;-)
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

actually try this code instead, for sendmail.php:

Code: Select all

<? 
if($name == "" || $comment == "") &#123; 

   print('<html><head><title>error</title></head>'); 
   print('<body>Please make sure to fill in all fields...go back and try again.'); 
   print('</body></html>'); 
      
     &#125; 
    
    else 
  &#123; 
  
  $main_message = "
  $name
  $comment 
  $REMOTE_ADDR"; 
  
  $email_2 = "YOUR_EMAIL_ADRESS_GOES_HERE"; 
    
  mail($email_2, $subject,$main_message,"From:$name"); 
  echo "<html><body>Sent</body></html>"; 
  &#125; 

?>
Jensen
Forum Newbie
Posts: 6
Joined: Sun May 05, 2002 11:30 pm

Thank You

Post by Jensen »

THANKS SO MUCH .. I OW U 1
Post Reply