Php email function not working

when I tried to send mail using the php mail function to localhost, I get the following error .... what could be the problem .... I even tried changing the php.ini file and gave the smtp host value of my service provider value and still working

Warning: mail () [function.mail]: Failed to connect to the mail server on port "localhost" 25, check the settings "SMTP" and "smtp_port" in php.ini or use ini_set () in

+2
source share
3 answers

For me, adding the following code in the calling file is a trick

// xampp code fix ini_set( 'sendmail_from', " myself@my.com " ); \\ My usual e-mail address ini_set( 'SMTP', "mail.bigpond.com" ); \\ My usual sender ini_set( 'smtp_port', 25 ); 
+2
source

I used Fake Sendmail to successfully send emails from my localhost using WAMP.

Try running here to run it.

+1
source

Do you have a mail server configured on localhost? Otherwise, in order to use mail, you probably have to use your smtp server providers instead of the local host to connect.

0
source

All Articles