Jump to content

PHP mail()function


rabbitsfeat

Recommended Posts

Hi everyone, I'm very new to PHP and have started by following the tutorials on w3schools.

 

I'm getting on ok but have run into a problem concerning the email tutorial. See here: http://www.w3schools.com/php/php_mail.asp

 

I've entered this code as they've said:

<?php
$to = "[email protected]";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "[email protected]";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>

 

And I'm getting this error message: 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\Apache Group\Apache2\htdocs\contact.php on line 27

Mail Sent.

 

I think it has something to do with my PHP setup and an .ini file, but other than that I have no idea! Please can somebody help me?

 

I'm running the apache server on my computer on windows XP Home edition... if that helps.

 

Cheers and hope to be a regular around here as my knowledge of PHP improves.

Link to comment
https://forums.phpfreaks.com/topic/89281-php-mailfunction/
Share on other sites

Where do I find php.ini? I follwed the sitepoint video by Kevin Yank to install everything so not sure if in the usual place!

 

Also, how do I find out what my ISP's SMTP server is?

 

Actually I'm not sure if I even have a SMTP setting listed in my php.ini file...

Link to comment
https://forums.phpfreaks.com/topic/89281-php-mailfunction/#findComment-457167
Share on other sites

is the server linux and did you set it up so have full root access then you could configure sendmail to send to your isp's SMTP

do you have a email account with your ISP then you can proberly access your ISP SMTP server by SMTP.[isp].com replace [isp] with your isp address AOL would be smtp.aol.com

 

Scott.

Link to comment
https://forums.phpfreaks.com/topic/89281-php-mailfunction/#findComment-457183
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.