-3

It causes the following error related to a mail server or php.ini file.

Warning: 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 E:\wamp\www\pr\mail.php on line 14

Warning: 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 E:\wamp\www\pr\mail.php on line 15

Community
  • 1
  • 1
Alpesh Rathod
  • 385
  • 3
  • 10

1 Answers1

1

First, you need to have a mail server setup somewhere. For that, you need the Hostname, port (usually 25), and possibly username and password. Google for example offers SMTP services (Send email using the GMail SMTP server from a PHP page), but you can use other servers if you have.

The error tells you that you don't have a mailserver setup on your machine, or it does not listen to the 25 port. If it's a shared hosting, you need to call the hosting company to assist you with this. If it's a dedicated server, then you may want to install a mailserver on that machine. If you don't want to install a mailserver, you can use Google or other provider, and you'll have to follow the steps provided here: smtp configuration for php mail or in the other link above

Community
  • 1
  • 1
Dan Bizdadea
  • 1,292
  • 8
  • 15