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

error when trying to e-mail...

the mail() function

Moderators: macek, egami, gesf

error when trying to e-mail...

Postby dtvonly » Tue Oct 24, 2006 7:52 pm

Hi. I am using Apache's localhost server, with PHP 5.02. I am trying out the e-mail option with the following simple code:

<?
$to = "dtvonly@yahoo.com";
$subject = "Hi";
$body = "Testing PHP e-mail";
if (mail($to, $subject, $body))
{
echo("<p>Message successfully sent!</p>");
}
else
{
echo("<p>Message delivery failed...</p>");
}
?>

...but got the following 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\apache group\Apache2\htdocs\daifiles\emailing.php on line 6

Message delivery failed...

I have no idea what to do. Someone please help? Thank you.
dtvonly
New php-forum User
New php-forum User
 
Posts: 6
Joined: Thu Oct 05, 2006 1:54 pm

mail problem

Postby Mukseh » Mon Nov 06, 2006 12:40 am

HI,

you have to modify your code here.

Please download phpmailer class from http://www.phpclasses.org

You are given there smtp options and works fine on local pc and online too.
User avatar
Mukseh
New php-forum User
New php-forum User
 
Posts: 156
Joined: Wed Mar 22, 2006 2:22 am
Location: Ahmedabad, Gujarat, India


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.