bsfischer Posted August 20, 2007 Share Posted August 20, 2007 Hey guys. first post here. I am having to change a php script to work on a Windows server and can't get it to work. It's an old file but works great on a Linux server. Any clues or help would be aewsome!! I am using it with HTML email form. <?php include("cleanup_text.php"); $textfield10 = wordwrap($textfield10, 60, "\n"); $textfield11 = wordwrap($textfield11, 60, "\n"); $textarea12 = wordwrap($textarea12, 60, "\n"); $textarea14 = wordwrap($textarea14, 60, "\n"); if(!strchr($checkbox1,"@") && !strchr($checkbox2,"@") && !strchr($checkbox3,"@") && !strchr($checkbox4,"@") && !strchr($checkbox5,"@") && !strchr($checkbox6,"@") && !strchr($checkbox7,"@") && !strchr($checkbox8,"@") && !strchr($checkbox9,"@") && !strchr($checkbox10,"@") && !strchr($checkbox11,"@") && !strchr($checkbox12,"@") && !strchr($checkbox13,"@") && !strchr($checkbox14,"@") && !strchr($checkbox15,"@") && !strchr($checkbox16,"@") && !strchr($checkbox17,"@") && !strchr($checkbox18,"@") && !strchr($checkbox19,"@") && !strchr($checkbox20,"@") && !strchr($checkbox21,"@") && !strchr($checkbox22,"@") && !strchr($checkbox23,"@") && !strchr($checkbox24,"@") && !strchr($checkbox25,"@") && !strchr($checkbox26,"@") && !strchr($checkbox27,"@") && !strchr($checkbox29,"@") && !strchr($checkbox30,"@") && !strchr($checkbox31,"@") && !strchr($checkbox32,"@") && !strchr($textfield16,"@")) { echo("<h2>Please enter a valid email address.</h2><h2>Click on BACK button in the browser to correct it.</h2>\n"); return; } $fd1 = popen("/usr/lib/sendmail -t","w"); fputs($fd1, "To: $checkbox3, $checkbox4, $checkbox5, $checkbox6, $checkbox7, $checkbox8, $checkbox10, $checkbox11, $checkbox12, $checkbox13, $checkbox16, $checkbox17, $checkbox18, $checkbox21, $checkbox22, $checkbox23, $checkbox24, $checkbox25, $checkbox26, $checkbox27, $checkbox29, $checkbox31, $checkbox32, $textfield16\n"); fputs($fd1, "Cc: $checkbox9, $checkbox14, $checkbox15, $checkbox19, $checkbox20, $checkbox30\n"); fputs($fd1, "From: example@test.com\n"); fputs($fd1, "Subject: $Subject $Subject1 $textfield1\n\n"); fputs($fd1, "Status: $RadioGroup1\n\n"); fputs($fd1, "Notification Date: $textfield2 CST: $textfield3\n\n"); fputs($fd1, "Actual Down Date: $textfield4 CST: $textfield5\n\n"); fputs($fd1, "Estimated Up Time Date: $textfield6 CST: $textfield7\n\n"); fputs($fd1, "Actual Resolution Date: $textfield8 CST: $textfield9\n\n"); fputs($fd1, "Components Affected: $textfield10\n\n"); fputs($fd1, "Incident: $checkbox1\n\n"); fputs($fd1, "Outage: $checkbox2\n\n"); fputs($fd1, "Impacted Locations: $textfield11\n\n"); fputs($fd1, "Contingency Instructions: $textarea12\n\n"); fputs($fd1, "Reporting Location: $textfield13\n\n"); fputs($fd1, "Reported By: $select\n\n"); fputs($fd1, "Initial Outage/Incident Comments: \n$textarea14\n\n"); fputs($fd1, "IF YOU ARE ASSOCIATED WITH MORE THAN ONE USER GROUP\n"); fputs($fd1, "YOU MAY RECEIVE MORE THAN ONE NOTIFICATION.\n\n"); fputs($fd1, "PLEASE DO NOT RESPOND TO THIS EMAIL.\n\n"); pclose($fd1); echo("<h4>Your outage notification has been sent. Thank you.</h4>\n"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/65852-wont-work-in-windows-server-environment/ Share on other sites More sharing options...
jcanker Posted August 20, 2007 Share Posted August 20, 2007 Because your code makes this reference: $fd1 = popen("/usr/lib/sendmail -t","w"); that's a linux filesystem reference, not a windows reference. Beyond that, I think it's calling the linux sendmail, which doesn't exist on a Windows box. I run php on IIS (Win2K3 server) and use php's mail function. To use that you just have to configure php.ini to use the proper mail server in your environment and make sure that the mail server isn't locked down so tight that it won't accept the data from the php code. Quote Link to comment https://forums.phpfreaks.com/topic/65852-wont-work-in-windows-server-environment/#findComment-329157 Share on other sites More sharing options...
bsfischer Posted August 20, 2007 Author Share Posted August 20, 2007 Whats the syntax for referencing SMTP for Windows server? Quote Link to comment https://forums.phpfreaks.com/topic/65852-wont-work-in-windows-server-environment/#findComment-329207 Share on other sites More sharing options...
jcanker Posted August 20, 2007 Share Posted August 20, 2007 Well, that depends on what your mail program is. IIS has a basic SMTP server wrapped into it but it's the suxxors and just asking for smtp relays to slam your network. Beyond that, most Windows environments will run Exchange in an Active Directory environment, and some might just use the mail services on a linux box somewhere. trust me....use the mail function if your mail server isn't locked down. It's super easy and allows you to adjust who the mail appears to come from etc. If your mail server is locked down too tight, then install Mercury Mail on the machine and point the php.ini mail section to that address. Quote Link to comment https://forums.phpfreaks.com/topic/65852-wont-work-in-windows-server-environment/#findComment-329222 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.