Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

An SMTP problem

the mail() function

Moderators: macek, egami, gesf

An SMTP problem

Postby carla » Tue Nov 20, 2012 12:27 am

I'm a complete beginner and trying to work my way through the Head First book, PHP & MySQL.
I'm having a problem in Chapter 1, the final version of the form will not work and is giving this error:

Warning: 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\hf\examples\ch01\final\aliens\report.php on line 30

I think my SMTP isn't set up, I am using Apache, not IIS. I have no idea how to fix this problem and set up the SMTP. I'm not even sure what the problem is. Could anyone please advise me on how to fix this? I'm stuck here and I want to get on with learning PHP.
carla
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Nov 20, 2012 12:24 am

Re: An SMTP problem

Postby seandisanti » Fri Nov 23, 2012 2:43 pm

You probably don't have a mail server setup/running. It's not a big deal, and it's one easily rectified. The easiest thing to do would be to look up instructions for using mail() with a remote smtp server, and then configure your php to use an external server like gmail with an existing account. or you can just say "oh, that's why it doesn't work when i run it locally" and move on to chapter 2. The first is the 'official' answer, the second is the route i chose when faced with the same problem (except was developing locally before pushing to a live site) Rather than waste time making it work locally, i held off on troubleshooting mail until the script was in place with a mail server and working credentials, and then it worked fine.
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 770
Joined: Mon Oct 01, 2012 12:32 pm

Re: An SMTP problem

Postby carla » Sun Nov 25, 2012 2:52 am

Thanks for your advice, I appreciate it. I think I will choose the second way, to just ignore it and move on to chapter 2. I will figure out how to set that up later on; you're right, it's not worth making it work locally.
carla
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Nov 20, 2012 12:24 am

Re: An SMTP problem

Postby seandisanti » Mon Nov 26, 2012 10:07 am

Glad to help, and I know how frustrating that part is, I think i spent a few hours trying to make it work locally on mine before i understood the problem enough to ignore it. lol
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 770
Joined: Mon Oct 01, 2012 12:32 pm


Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron