0

i am trying to send an email using wamp server and i get 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 ..

Anyone know what could be the problem?

JCOC611
  • 19,111
  • 14
  • 69
  • 90
Bora Bogdan
  • 67
  • 1
  • 2
  • 12

3 Answers3

1

The message is correct.

You use the mail function and this points to localhost in your php.ini. But i think you don't run an Email Server on your local mashine.

If you need the emails on your local mashine you should install a mailserver like hMailServer and configure the mailserver that he catch all email that come from localhost. There are some informations and introductions on the website.

René Höhle
  • 26,716
  • 22
  • 73
  • 82
0

Use the PHPMAILER class. It is much easier then using the PHP's own mail function. It allows you to specify your smtp login information for your email server which is required. At the moment you are not connecting to a SMTP server, let alone have a username and password setup. For newbies, PHPMAILER is a much more practical way forward.

Zevi Sternlicht
  • 5,399
  • 19
  • 31
0

Yes this is because you dont have a SMTP server running for PHP to use. What this means is that you have to either do some editing in the php.ini file and/or run a mailserver locally wich is a shore or you could install this tool: test mail server tool to test sending email locally.

This should work right out of the box.

NOTICE this is not for production environments!

NOTE 2 I can't really take credit for this answer see: This question

Community
  • 1
  • 1
Daniel Figueroa
  • 10,348
  • 5
  • 44
  • 66