Page 1 of 1
HELP!
Posted: Sun May 05, 2002 11:30 pm
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

, Any Ideas
Http://www.doomtfc.2y.net/new/poll/ <----- where it says contact us i would like a script on there
PLEASE HELP ME!
Posted: Mon May 06, 2002 12:17 am
by hob_goblin
Code: Select all
<?
if($name == "" || $comment == "") {
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>');
}
else
{
$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>";
}
?>
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

Posted: Mon May 06, 2002 6:40 am
by Jensen
erm ok help .. i am a n00b
Posted: Mon May 06, 2002 6:47 am
by Jensen
wat i meen is .. will it use the sendmail .. or wat
Posted: Mon May 06, 2002 7:07 am
by Jensen
i get a error in line 16
SMTP servers...
Posted: Mon May 06, 2002 8:28 am
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.
Posted: Mon May 06, 2002 2:27 pm
by phice
Posted: Mon May 06, 2002 4:17 pm
by Jensen
phice wrote:
should be changed to
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
Posted: Mon May 06, 2002 4:22 pm
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

Posted: Mon May 06, 2002 4:24 pm
by hob_goblin
actually try this code instead, for sendmail.php:
Code: Select all
<?
if($name == "" || $comment == "") {
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>');
}
else
{
$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>";
}
?>
Thank You
Posted: Mon May 06, 2002 5:25 pm
by Jensen
THANKS SO MUCH .. I OW U 1