Contact script - testmy.net resource / tool
Home
Welcome, Guest. Please login or register.
Did you miss your activation email?

 



donations help testmy.net pay for the very high cost to run the site. Any amount is greatly appreciated.
Click to read why...

  spcr
    
News : Before you post... try a Why don't you search? - Many simple questions have already been answered.  If your query turns up dry then post, we always have people waiting for your questions. azn January 07, 2009, 06:31:41 PM
testmy.net Broadband  |  Main Forum  |  HELP!  |  Programming and Website Help  |  PHP  |  Topic: Contact script Advanced search

Recommended Tests

Click here to run a free Performance Scan
  Test PC Performance:
     Click here to run a free Performance Scan
    Test PC Stability:
     Click here to run a free Registry Scan


Note: The links above are sponsored links
  0 Members and 1 Guest are viewing this topic. « previous next »
Pages 1 Go Down
Author
Topic: Contact script  (Read 4434 times)
wmmc
Guest
« on: January 26, 2005, 10:08:18 PM »

Code:
<?php
  
if($_SERVER['REQUEST_METHOD'] == "POST") {
  
  $receiverMail
"Your email address here";
  
  $name
ltrim(rtrim(strip_tags(stripslashes($_POST['name']))));
  $email ltrim(rtrim(strip_tags(stripslashes($_POST['email']))));
  $subject                      ltrim(rtrim(strip_tags(stripslashes($_POST['subject']))));
  $msg ltrim(rtrim(strip_tags($_POST['msg'])));
  
  $ip
getenv("REMOTE_ADDR");
  $msgformat "From: $name ($ip)\nEmail: $email\n\n$msg";
  
  
// VALIDATION
  if(empty($name) || empty($email) || empty($subject) || empty($msg)) {
  echo '<font color="#ff0000"><b>Unable to send email: missing fields</b></font><br /><small>(press your browser back button)</small>'// add here a message or image for missing fields
  }
  elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$email)) {
  echo '<font color="#ff0000"><b>Unable to send email: invalid email address</b></font><br /><small>(press your browser back button)</small>'// add here a message or image for invalid email
  }
  else {
  mail($receiverMail$subject$msgformat"From: $name <$email>");
  echo '<font color="#008000"><b>Email sent successfully</b></font>'// add here a message email is successful
  }
  }
  ?>
</center>
  <form action="?email=send" method="post">
  <table border="0" align="left" cellpadding="6" cellspacing="0" width="450px">
  <tr>
  <td valign="middle"><b>Name:</b></td><td><input type="text" name="name" size="40" title="First and last name, last is optional"></td><tr>
  <td valign="middle"><b>Email:</b></td><td><input type="text" name="email" size="40" title="yourname@somewhere.com"></td><tr>
  <td valign="middle"><b>Subject:</b></td><td><input type="text" name="subject" size="40"></td><tr>
  <td valign="middle"><b>Comment:</b></td><td><textarea rows="7" cols="31" name="msg"></textarea></td><tr>
  <td valign="middle"><br></td><td align="left"><input type="submit" value="Send!">&nbsp;&nbsp;&nbsp;<input type="reset" value="Reset"></td>
  </tr>
  </table>
  </form>

Table area can be modified how you see fit for your site.

Edit: Seems to be extra characters in the code, attached a text file.
« Last Edit: January 26, 2005, 10:31:16 PM by wmmc » Logged
wmmc
Guest
« Reply #1 on: January 26, 2005, 10:19:37 PM »

Example of it here.

Name the page whatever, but it needs to be whatevername.php
Logged
wmmc
Guest
« Reply #2 on: January 27, 2005, 12:52:21 AM »

I should let you know this was not created by me, I am just learning PHP, I got it from a web site that allows you to use code for free, hey I needed help, I did however modify it to my liking and added to it.

http://www.hotscripts.com/
http://www.planet-source-code.com/
« Last Edit: January 27, 2005, 12:55:45 AM by wmmc » Logged
matrix4583
New Member
*
Offline Offline

Posts: 10


View Profile
« Reply #3 on: May 30, 2005, 04:45:04 PM »

I should let you know this was not created by me, I am just learning PHP, I got it from a web site that allows you to use code for free, hey I needed help, I did however modify it to my liking and added to it.

http://www.hotscripts.com/
http://www.planet-source-code.com/

WH CAN'T I SEE MY OWN MAIL THAT I SENT FROM THE SCRIPT? I E MAIL BACK TO HOTMAIL.COM, BUT I DID'NT GET MY MAIL. I PUT MY MAIL ADDRESS IN THE SCRIPT, BUT NOTHING SHOWED UP AT HOTMAIL.
Logged
php
Vice Admin
TMN Seasoned Veteran
*
Offline Offline

Gender: Male
Posts: 5128



View Profile
« Reply #4 on: May 30, 2005, 07:07:52 PM »

1 reason... the script isn't set up right

also, there is no need for all caps ;)
Logged

matrix4583
New Member
*
Offline Offline

Posts: 10


View Profile
« Reply #5 on: May 30, 2005, 10:23:47 PM »

1 reason... the script isn't set up right

also, there is no need for all caps ;)

this is wat i get when sending the mail:

 Warning: mail() [function.mail]: SMTP server response: 553 We do not relay non-local mail, sorry. in C:\9\1.php on line 34

Email sent succesfully
Logged
php
Vice Admin
TMN Seasoned Veteran
*
Offline Offline

Gender: Male
Posts: 5128



View Profile
« Reply #6 on: May 31, 2005, 06:12:44 AM »

The SMTP server is rejecting the mail... pick a different SMTP server...
Logged

matrix4583
New Member
*
Offline Offline

Posts: 10


View Profile
« Reply #7 on: May 31, 2005, 08:43:10 PM »

The SMTP server is rejecting the mail... pick a different SMTP server...

how? in the script contact.cfg?
Logged
php
Vice Admin
TMN Seasoned Veteran
*
Offline Offline

Gender: Male
Posts: 5128



View Profile
« Reply #8 on: May 31, 2005, 08:48:33 PM »

what's the name of the script you're using?
Logged

matrix4583
New Member
*
Offline Offline

Posts: 10


View Profile
« Reply #9 on: June 01, 2005, 07:20:19 PM »

what's the name of the script you're using?

what do u mean? i use dreamweaver. i got the script from the poster that post the one about the contact script. i copy it.
Logged
matrix4583
New Member
*
Offline Offline

Posts: 10


View Profile
« Reply #10 on: June 01, 2005, 07:20:51 PM »

what do u mean? i use dreamweaver. i got the script from the poster that post the one about the contact script. i copy it.

also my aim is matrix45834583. hit me up Smile.
Logged
Print  Pages 1 Go Up
testmy.net Broadband  |  Main Forum  |  HELP!  |  Programming and Website Help  |  PHP  |  Topic: Contact script « previous next »
Jump to:  

    
testmy.net's forum is proudly Powered by SMF | SMF © 2006-2007, Simple Machines LLC
Bookmark: Del.icio.us    StumbleUpon
 
 

 

© 1999-2008 testmy.net - Contact - Legal - Facts & FAQs
Page Loading Stats: This forum Page created in 0.117 seconds with 47 queries.