Jump to content

Php Mail() problem on Windows Server


sudhakarReddy

Recommended Posts

I Have a Feedback form in my site. when i submitting the form in Linux server it is working fine. But in Windows server the mail was not sending. here is my code<?php $to = "sudhakar@mysite.com"; $subject = $_REQUEST['Feedback'] ; $email = $_REQUEST['Email'] ; $message = $_REQUEST['Summary'] ; $From = $_REQUEST['Name'] ;$headers = "From: $email"; $sent = mail($to, $subject, $message, $headers); if($sent) {print "Your mail was sent successfully"; }else {print "We encountered an error sending your mail"; }?> when i running this code in Windows server the message is shows "We encountered an error sending your mail"So, Plz help me what is the error and how to catch that error?plz, it is urgent

Link to comment
Share on other sites

Are you sure that you have high enough PHP to have mail() on the windows server? I think dcole.ath.cx had this problem.. he had to move something around.

Link to comment
Share on other sites

Check your PHP version. If it's < than v3, then you can't use the mail() function, or if it's a very low sub version 3, then it might not be able to handle some of the arguments you're sending. :)

Link to comment
Share on other sites

If the mail function was not there, the error would be different. It looks like the server is actually trying to generate and send an email, but is not able to.The first step is obviously to make sure you have a mail server running. Go into IIS, find where it says "Default Web Site", and make sure that there is also a "Default SMTP Site" or some other SMTP site, and that it is running.One thing to test is to have a Windows Explorer window open to your mail server queue folder (/Inetpub/mailroot/queue), test your mail script and see if you can see a mail file get created in the queue folder. It will happen quick, so make sure you always have the Explorer window open when you are testing. If you see a file get created and deleted, then the problem is with the mail server itself, it's not able to actually send the mail once it gets created.If everything looks normal, check the Event Log. If you have Windows 2000, XP, or 2003, go to the control panel, open Administrative Tools, open Event Viewer, and take a look in the Application Log for messages coming from iisadmin, www, or smtp services.

Link to comment
Share on other sites

Another thing you could check is to create a PHP info page:

<?php phpinfo(); ?>

Check to see what the value of SMTP is, it should be pointing to the mail server you are trying to use. You can also see smtp_port, and the path to sendmail. Are you running this on a home computer? It's entirely possible your ISP has the outgoing SMTP port blocked (most ISPs block it). If you run that code online on a live server I'm sure it would work.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...