email

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sweetcoz
Forum Newbie
Posts: 4
Joined: Tue Jan 09, 2007 4:22 am

email

Post by sweetcoz »

hi everyone,
my php.ini mail section is setup as follows:

Code: Select all

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
then in my php script:

Code: Select all

mail("joecool@hotmail.com", "Testing", "Line 1\nLine 2\nLine 3", "From: tom@hotmail.com") or die("email error");
but i keep getting this error:
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:\Program Files\xampp\htdocs\test.php on line 2

on all tutorials that i went, the mail fucntion is written this way
what is wrong?
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

Do you have an SMTP server set up on localhost? If not, that's why it's failing...
Post Reply