Jump to content


Photo

PHP Email Form


  • Please log in to reply
2 replies to this topic

#1 pluginbaby

pluginbaby
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 18 August 2006 - 10:39 AM

I used this email form:

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email
  $email = $_REQUEST['email'] ; 
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;
  mail( "someone@example.com", "Subject: $subject",
  $message, "From: $email" );
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='post' action='mailform.php'>
  Email: <input name='email' type='text' /><br />
  Subject: <input name='subject' type='text' /><br />
  Message:<br />
  <textarea name='message' rows='15' cols='40'>
  </textarea><br />
  <input type='submit' />
  </form>";
  }
?>

And when I tried it on my local server I got this error:

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\xampp\htdocs\BART2\nl\test.php on line 10


What can I do about that?

#2 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 18 August 2006 - 11:17 AM

look for the SMTP setting in your php.ini file

it will be set to localhost...

all you need to do is set it to the smtp of your ISP and it will all work fine (he says ;))
follow me on twitter @PHPsycho

#3 pluginbaby

pluginbaby
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 18 August 2006 - 11:33 AM

thank you  ;D

It also says I can use this function: ini_set()

How should that function be used? I mean what should be between the () ?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users