logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: php code not working
Author
peacemaker



Joined: 23 May 2008
Posts: 80

PostPosted: Mon 18 Aug '08 1:34    Post subject: php code not working Reply with quote

Hi friends,
I am designing a web site which contains 1 enquiry form. I build the form and did the validations with javascript.
Now when i submit the form to send the email using php code it does nothing, the whole blank page comes up, i tried to show the inputs before it send the mail, it shows nothing, but when i comment the mail() then and try to see wats the input is it shows correct result. I dont know wats wrong with it. Actually before this i have nt used this mail(). so does i need to do any changes in php.ini or any other place. i did some chances in php.ini, i m giving my php code and the php.ini changes. Please let me know if i need to make more chance in any other file of php or apache.

php.ini (this is my modified file)
Code:

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
sendmail_from =myid@hotmail.com


mail() php code

Code:

<?php


echo "<p> Thank You, <b>".$_POST["contactname"]."</b>, for the message!</p>";
echo "<p> Your Email address is :--, <b> ".$_POST["email"]."</b> </p>";
echo "<p> Your Message Was :--  <br /></p>";
echo "<p>".$_POST["details"]."</p>";

//start building the mail string


$msg  ="Name :    ".$_POST["contactname"]."\n";
$msg  .="E-Mail:--   ".$_POST["email"]."\n";
$msg  .="Message:--  ".$_POST["details"]."\n";

//set up the mail

$recipient = "myid@yahoo.com";
$subject = "Enquiry about event";
$mailheaders = "From :My Web Site <koolkedar@hotmail.com> ""\n";
$mailheaders .= "Reply-To: ".$_POST["email"].; 


mail($recipient,$subject,$msg,$mailheaders);

?>



I need urgent help as this will finish my web site.
I will be thankful for the urgent help.
Thanks in Advance.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Tue 19 Aug '08 11:14    Post subject: Reply with quote

add error_reporting(E_ALL & ~E_NOTICE); to your PHP code after the <?php to locate the error.
Back to top
peacemaker



Joined: 23 May 2008
Posts: 80

PostPosted: Wed 20 Aug '08 19:26    Post subject: Mail() error Reply with quote

Hi James
As u said to put the line for getting error messages. I put that line. But no clue that where the error are going to display. But any way i checked the error log in apache. I found the errors there. Its now giving warning related to the port. i m giving the error message which is displaying plz let me know wats happening.
As usual thanks in advance.
Quote:


PHP Warning: mail() [<a href='function.mail'>function.mail</a>]: Failed to connect to mailserver at &quot;localhost&quot; port 25, verify your &quot;SMTP&quot; and &quot;smtp_port&quot; setting in php.ini or use ini_set() in E:\\Keleidoscope\\enquiryform.php on line 67


wat can be the possible reasons. I am using wireless internet with wireless router.
We 4 flatmates share the intetnet.
Is the port problem related to that please let me know.
Else how can i check the port connectivity.
In my previous post u can see the php.ini setting. hope they are ok.
thanks in advance.
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3092
Location: Hilversum, NL, EU

PostPosted: Wed 20 Aug '08 22:24    Post subject: Reply with quote

Do you run a mailserver ?

If not, use the mailserver (SMTP) from your ISP.

Steffen
Back to top


Reply to topic   Topic: php code not working View previous topic :: View next topic
Post new topic   Forum Index -> Other Software