Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

Script for form to email??

Namecheap AuctionsNamecheap Auctions
Spacemail by SpaceshipSpacemail by Spaceship
SpaceshipSpaceship
Watch

JH

Established Member
Impact
5
hi,

dose anyone know a script to place on my site that will send form information to my email???
 
Close
0
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
check hotscripts.com, sourceforge.net, freshmeat.net
 
Close
0
PHP:
<? 

mail ("email here", "$subject","$message");

?>
 
Close
0
Close
0
cheers i will have a look
 
Close
0
I can program you one if you wish.

CyberSpatium said:
check hotscripts.com, sourceforge.net, freshmeat.net

That is correct. These sites are preferable!
 
Close
0
i say hotscripts.com is your best choice i got mines from there last time
 
Close
0
its really easy...i can make 1 for u if u want
 
Close
0
Come up with one on the spot :P

PHP:
<?php

echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>
Name:
<br>
<input type='text' name='name'>
<br>
E-mail:
<br>
<input type='text' name='email'>
<br>
Message:
<br>
<textarea name='message' rows='10' cols='40'></textarea>
<br>
<br>
<input type='submit' name='submit' value='Submit'>
</form>";

if($_POST['submit'])
{
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];
  
  if(empty($name) || empty($email) || empty($message))
  {
    echo "All fields required. Please enter all information and try again.";
  }
  else
  {
    $name = stripslashes($name);
    $message = trim(stripslashes($message));
    $message = wordwrap($message, 70, "<br>\n");

    $recip = "[email protected]";
    $subject = "Message from yoursite.com";

    $headers = 'From: '.$email.'';

    mail("$recip", "$subject","

    Name:
    $name

    Email:
    $email

    Message:
    $message

  ", $headers);
  
  if(!mail)
  {
    echo "Seems to have been a problem, your message could not be sent, please try again later."
  }
  else
  {
    echo "Thank you, ".$name." for contacting us.";
  }
}
?>

:) It can be customized as well. If you require more data etc, should be easy to add the fields, etc...

-Eric
 
Close
0
Eric, if I just edited the email address and saved that code as contact.php, should it work as is? Or do I need to do something more? I tried it as is and get a 'Parse error line 57'.
 
Close
0
Gene said:
Eric, if I just edited the email address and saved that code as contact.php, should it work as is? Or do I need to do something more? I tried it as is and get a 'Parse error line 57'.
Yes, should work as is, and for the parse error (stupid me) missing a ; on this line:

PHP:
echo "Seems to have been a problem, your message could not be sent, please try again later."

And it should be:

PHP:
echo "Seems to have been a problem, your message could not be sent, please try again later.";
 
Close
0
Hmm, now getting parse error on line 63 (last line).
 
Close
0
Grrr, I need some sleep:

PHP:
<?php

echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>
Name:
<br>
<input type='text' name='name'>
<br>
E-mail:
<br>
<input type='text' name='email'>
<br>
Message:
<br>
<textarea name='message' rows='10' cols='40'></textarea>
<br>
<br>
<input type='submit' name='submit' value='Submit'>
</form>";

if($_POST['submit'])
{
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];
  
  if(empty($name) || empty($email) || empty($message))
  {
    echo "All fields required. Please enter all information and try again.";
  }
  else
  {
    $name = stripslashes($name);
    $message = trim(stripslashes($message));
    $message = wordwrap($message, 70, "<br>\n");

    $recip = "[email protected]";
    $subject = "Message from yoursite.com";

    $headers = 'From: '.$email.'';

    mail("$recip", "$subject","

    Name:
    $name

    Email:
    $email

    Message:
    $message

  ", $headers);
  
  if(!mail)
  {
    echo "Seems to have been a problem, your message could not be sent, please try again later.";
  }
  else
  {
    echo "Thank you, ".$name." for contacting us.";
  }
}
}
?>
 
Close
0
BINGO! Works like a charm. Thank you!
 
Close
0
Gene said:
BINGO! Works like a charm. Thank you!
No problem :) And like I said, it can easily be customized for more fields and what not. If you need any added (anyone) let me know and I'll add them. :tu:
 
Close
0
CatchedCatched

We're social

Escrow.com
Spaceship
CryptoExchange.com
Domain Recover

NamePros updates

Quick replies: search, your most used replies, and more on every post
Quick replies are easier to find and use now. The quick reply menu has a search box. Type a few letters to find the reply you want. A...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back