Problem Sending Mail!

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
whci98
Forum Newbie
Posts: 3
Joined: Fri Nov 07, 2003 10:41 am

Problem Sending Mail!

Post by whci98 »

Hi,
I'm trying to use the mail() function but I'm have problems. I very new to PHP. Below is my PHP code and the error I get when I run it. Do I need to get SMTP port number from somewhere? please help :(

Code: Select all

<?php

mail("nouman@rogers.com", "My Subject", "Line 1\nLine 2\nLine 3");

?>
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()
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Your php is set to use localhost as mailserver, but you have not mailserver at your host. Do you use some sort of Win as your OS?
whci98
Forum Newbie
Posts: 3
Joined: Fri Nov 07, 2003 10:41 am

Post by whci98 »

I'm using Win XP Pro.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

then edit php.ini. replace lines

Code: Select all

SMTP = localhost
;sendmail_from = me@localhost.com
with

Code: Select all

SMTP = mail_server_of_your_ISP_here
sendmail_from = your_email_here
Post Reply