Question

i'm trying to create a contact form,with a code from a website,but when i open it with localhost,it give me an error:

   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 D:\programe\wamp\www\website\trimite.php on line 41

Well,this is the line 41:

    mail($catre, $subiect, $mesaj, $headere);

It is anything wrong? Maybe it's because i need a database,or i dont know,im not really good at this.

Was it helpful?

Solution

Probably this is way too old, but since I have an easy fix (I guess) I will give it a shot:

If you only want to try the code (mail function) and see if the email is actually sent, in your dev environment, you can try to accomplish that with this small tool: http://www.toolheap.com/test-mail-server-tool/

I used it several times in the past when I had no proper smtp mail server configuration available and I had to test in a few seconds that my code was behaving properly.

I hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top