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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top