Hello. I'm having a lot of trouble trying to get the mail function to work in chapter 11. I am using the same code as in the book at the start of the chapter,
<?php
mail("localhost", "Hello World", "Hi, world. Prepare for our arrival. We're starving!") or die("Epic Fail");
?>
I keep getting the same error when i make calls to mail(),
Warning: mail() [function.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\wrox\chapter11\firstmail.php on line 2
I have modified the php.ini file accordingly:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
sendmail_from =
[email protected]
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =
I currently have set up:
WAMP v1.7.3
php_smtp is enabled in the php.ini file
I'm using a wireless Internet connection
I have enabled HTTP and SMTP authorisation on the Windows firewall.
Nothing I do seems to work and I keep getting the same error message. Please Help!
Thank you.