shane201980 Posted March 4, 2010 Share Posted March 4, 2010 First off I apologize if I missed something in the forums regarding this, but I did not find my answer. I have no knowledge of php, but I've been doing a lot of reading and am trying to incorporate it into my companies website for a contact form. Well the script works if I send it to my AOL account, but it does not send to our exchange server. Here is the code, maybe someone can help me out... "FORM" <form method="POST" name="validation" action="contact.php" onSubmit="return checkbae()","return createTarget(this.target)" target="formtarget",input type="reset"> <select name="recipient" size="1" align="left"> <option value="">Choose a Contact</option> <option value="recipient_1">First Contact</option> <option value="recipient_2">Second Contact</option> <option value="recipient_3">Third Contact</option> <option value="recipient_4">Fourth Contact</option> <option value="recipient_5">Fifth Contact</option> </select> <strong><div align="left">Select Contact <br><br> Email Message: (1000 Characters Max) <br> <textarea name="message" style="width:400px; height:150px" data-maxsize="1000" data-output="status1" wrap="virtual"></textarea><br /> <div id="status1" style="width:400px;font-weight:bold;text-align:right"></div><br /> <P><strong>Tell us how to get in touch with you:<br> Name <input type="text" size="35" maxlength="256" name="Name"><br> Company <input type="text" size="35" maxlength="256" name="Company"><br> Email <input type="text" size="35" name="emailcheck" value="***Email Address Required***" onFocus="this.value=''"><br> Telephone <input type="text" size="35" maxlength="256" name="Telephone"><br> FAX <input type="text" size="35" maxlength="256" name="Fax"><P> <input type="submit" value="Submit",onclick="return checksubmit(this)"> <input type="reset" value="Clear Form"></p></form> </strong></form> "PHP Script" <?php // get posted data into local variables $Subject = "Website Generated Email"; $Message = Trim(stripslashes($_POST['message'])); $Name = Trim(stripslashes($_POST['Name'])); $Company = Trim(stripslashes($_POST['Company'])); $Email = Trim(stripslashes($_POST['Emailcheck'])); $Telephone = Trim(stripslashes($_POST['Telephone'])); $Fax = Trim(stripslashes($_POST['Fax'])); // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Company: "; $Body .= $Company; $Body .= "\n"; $Body .= "Telephone: "; $Body .= $Telephone; $Body .= "\n"; $Body .= "Fax: "; $Body .= $Fax; $Body .= "\n"; $Body .= "Message: "; $Body .= $Message; $Body .= "\n"; // send email $recipients = array( 'recipient_1' => '[email protected]', 'recipient_2' => '[email protected]', 'recipient_3' => '[email protected]', 'recipient_4' => '[email protected]', 'recipient_5' => '[email protected]' ); $EmailTo = $recipients[$_REQUEST['recipient']]; $Email = $_REQUEST['emailcheck']; $success = mail($EmailTo, $Subject, $Body, "From: <$Email>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=Email Submittal.html\">"; } ?> Any ideas will be most appreciated... Link to comment https://forums.phpfreaks.com/topic/194074-php-can-reach-aol-but-not-ms-exchange-from-website/ Share on other sites More sharing options...
jcanker Posted March 4, 2010 Share Posted March 4, 2010 If AOL is receiving it, but your Exchange server isn't, then the problem isn't with your AOL code, it's something else; It could be the MX record, but I'm assuming that's fine if it's a corporate Exchange, unless it's something set up just for this project. Otherwise you'll have to delve into the config of the Exchange and see why it's refusing the connection--sounds like there's something in the config that's explicitly rejecting the email for some reason. I can tell you it's NOT because of a reverse lookup issue--AOL will automatically reject those on site, but yours are getting through. Link to comment https://forums.phpfreaks.com/topic/194074-php-can-reach-aol-but-not-ms-exchange-from-website/#findComment-1021242 Share on other sites More sharing options...
Rustywolf Posted March 4, 2010 Share Posted March 4, 2010 // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Company: "; $Body .= $Company; $Body .= "\n"; $Body .= "Telephone: "; $Body .= $Telephone; $Body .= "\n"; $Body .= "Fax: "; $Body .= $Fax; $Body .= "\n"; $Body .= "Message: "; $Body .= $Message; $Body .= "\n"; can be shortened to // prepare email body text $Body = "Name: " . $Name . "\n" . "Company: " . $Company . "\n" . "Telephone: " . $Telephone . "\n" . "Fax: " . $Fax . "\n" . "Message: " . $Message . "\n"; Link to comment https://forums.phpfreaks.com/topic/194074-php-can-reach-aol-but-not-ms-exchange-from-website/#findComment-1021259 Share on other sites More sharing options...
shane201980 Posted March 4, 2010 Author Share Posted March 4, 2010 I went back and started checking the logs for exchange and the email does not even show that it reached our server. I also installed GFI so that I could better monitor incoming mail, and hopefully allow everything just incase. Nothing shows up anywhere. So I went back to the Plesk Control Panel and found several error logs giving me the same error message over and over: [Wed Mar 03 16:30:10 2010] [error] [client 68.###.###.###] PHP Notice: Undefined index: Emailcheck in /var/www/vhosts/somewhere.com/httpdocs/contact.php on line 8, referer: http://somewhere.com/ContactUs.html Line 8 refers to: $Email = Trim(stripslashes($_POST['Emailcheck'])); Not sure exactly what this means. I don't know if it matters, but it appears that we are using PHP 3.0 with Safe Mode On. (This is all from our domain provider) Rustywolf, Thanks for the shorten Body; works just as good but saves a lot room. Link to comment https://forums.phpfreaks.com/topic/194074-php-can-reach-aol-but-not-ms-exchange-from-website/#findComment-1021502 Share on other sites More sharing options...
shane201980 Posted March 12, 2010 Author Share Posted March 12, 2010 SOLVED!!!!!!!!! This was a very simple solution especially considering the amount of trial and error I did. The problem is that our mail is being handled by an exchange server located here at our office and not through our domain provider. Because the email feature on our php file was sending to our domain addresses, the Plesk php feature which is offered from our domain provider was trying to deliver the mail locally rather than forwarding it to our exchange server like it should. ***Note: all of our records are correct, and mail is always delivered to our exchange server. Simple fix... I went into the mail feature under Services and "switched off" the mail service. From there the mail started being delivered to our exchange and the Plesk Control Panel no longer tried to deliver them locally. HOORAY!!!! Link to comment https://forums.phpfreaks.com/topic/194074-php-can-reach-aol-but-not-ms-exchange-from-website/#findComment-1025274 Share on other sites More sharing options...
shane201980 Posted March 12, 2010 Author Share Posted March 12, 2010 FYI... I removed line 8 as it did not seem to be necessary. Line 8 refers to: $Email = Trim(stripslashes($_POST['Emailcheck'])); Link to comment https://forums.phpfreaks.com/topic/194074-php-can-reach-aol-but-not-ms-exchange-from-website/#findComment-1025275 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.