0

I have one small problem. I want to directly send data in our email id, but I get the following 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:\wamp\www\my php\email.php on line 14

 $to = "ahsddif@kfdf.com"; 
 $subject = "Contact Us"; 
 $email = $_REQUEST['textlname'] ; 
 $message = $_REQUEST['message'] ; 
 $headers = "From: $email"; 
 $sent = mail($to, $subject, $message, $headers) ; 
 if($sent) 
   {print "Your mail was sent successfully"; }
  else 
   {print "We encountered an error sending your mail"; }

Can someone point me in the right direction?

Mihai Iorga
  • 39,330
  • 16
  • 106
  • 107
hadi
  • 49
  • 1
  • 5

2 Answers2

0

You wont be able to use WAMP alone to send an email, you will need to setup a mail server. Depending on how experienced you are with it, it could get tricky.

I just use my GoDaddy credentials with WAMP to send email, if you don't have a hosted solution I found the link below that seems to work but I haven't tried it.

Configure WAMP server to send email

Community
  • 1
  • 1
Drewdin
  • 1,732
  • 5
  • 23
  • 35
0

First of all: DO NOT use php mail function. Use a specific mailer class like PHPmailer.

http://code.google.com/a/apache-extras.org/p/phpmailer/

Your problem: you don't have a configured SMTP server on localhost. Look at PHPmailer example and use an external SMTP just like you would do with a mail client.

Ghigo
  • 2,312
  • 1
  • 18
  • 19