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 = 'feedback@3esolutionsindia.com';

$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: <webmaster@example.com>' . "\r\n";

$headers .= 'Cc: myboss@example.com' . "\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 = "employee1.3e@gmail.com";

$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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.