Regarding Mail function

  • Answered
Hi, I created a small register form and tried to use the mail function. But i received an error saying, 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 C:\wamp\www\php_sandbox\register.php on line 43

Can you kindly let me know how to connect to the SMTP server as i am new to PHP and still in the process of learning.
Hello Mahesh,

I see you are using WAMP on your local machine. by default, the SMTP protocol is not set up on a PC. Your setup is looking at 'localhost' which means it is looking to your local machine. You can certainly use the mail function, but you must set up the SMTP settings to look to a live mail server that you have an email account on.

The port will stay the same, but the host will need to be either the mail server's IP address or domain name.

Best Regards,
Scott M