Jump to content

Archived

This topic is now archived and is closed to further replies.

pluginbaby

PHP Email Form

Recommended Posts

I used this email form:

[code]<?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>";
  }
?>[/code]

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

[quote]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[/quote]

What can I do about that?

Share this post


Link to post
Share on other sites
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 ;))

Share this post


Link to post
Share on other sites
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 () ?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.