Sending Mail From Localhost in EasyPHP server

Jefree Sujit picture Jefree Sujit · Jan 4, 2015 · Viewed 8.5k times · Source

I am new to PHP, and am trying to design a site based on php for my college project. I use EasyPHP devServer 14.0. I have a register page, which mails a verification code to the user to his provided email id. For the demo project, I tried to send a mail from localhost to the user's mail Id, But it showed an error message like this:

Warning: mail(): Failed to connect to mailserver at "127.0.0.1" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()

I ve checked for previously existing solutions, but those solutions are for xampp or wamp servers and the php.ini file content differs between the servers. Could Someone Guide me how to configure the php.ini file in EasyPHP server? Could you please illustrate me with some example?

This is what I ve tried, Pardon me, if it seems to be a simple question.

$pmail = " [email protected]";
$subject = " email";
$message = "Hello User";
$headers = "From: [email protected]" . "\r\n" . "CC: [email protected]";

mail($pmail,$subject,$message,$headers);

Answer

Gilles Bossuyt picture Gilles Bossuyt · Jan 4, 2015

Change your php.ini file like this:

SMTP = smtp.example.com               // Set your SMTP server
smtp_port = 25                        // Set your SMTP port
sendmail_from = [email protected]      // Set your sender mailaddress