Jump to content

php mail


AbhiN

Recommended Posts

i m developing php page..

 

i've feedback form containing the fields name,email and comments,..

 

Using php i want to pass this data to comapanies mail addr..

 

i've tried to develope php as--

 

<?php

 

$name = $_POST["name"];

 

$email = $_POST["email"];             

$comments = $_POST["comments"];

 

$subject = "Feedback";

$sendto = '[email protected]';

$body = "comments: $comments\n";

 

$body = wordwrap($body, 70);

 

$headers = "MIME-Version: 1.0" . "\r\n";

$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

$headers .= 'From: <[email protected]>' . "\r\n";

$headers .= 'Cc: [email protected]' . "\r\n";

 

mail($sendto, $subject, $body, $headers);

 

echo "Thanks for your Feedback";

 

echo "Visit again";

 

?>

 

 

 

Now for time being i m using --

 

$name = "abhi";

$email = "[email protected]";

$comments = "demo";

 

to check the php..

 

i've installed Apache HTTP server 2.0 on my pc and tried to run this php..

 

3emails.php is in folder--  C:\Program Files\Apache Group\Apache2\htdocs

 

path to run --

 

http://localhost/3esmail.php

 

then it gives error as--

 

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\3esmail.php on line 20

Thanks for your FeedbackVisit again

 

 

 

then i've set in php.ini ---

 

[mail function]

; For Win32 only.

SMTP = localhost

smtp_port = 25

 

; For Win32 only.

;sendmail_from = NULL

 

 

 

then what is the problem??

 

wheather the php is correct??

 

how shold i check??

 

plz reply..

byee..

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

PHP is looking for a mail server on localhost (which is YOUR pc). Now i'm just taking a guess but I would say you're unlikely to have a mail server installed on your PC. Thus the mail function will not work until you have one. Alternatively as an option do what Wolphie suggests and download/install XAMPP which has lots of nice built-in bits (such as a mail server).

Link to comment
https://forums.phpfreaks.com/topic/90036-php-mail/#findComment-461633
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.