enpointe Posted November 24, 2008 Share Posted November 24, 2008 Hi all, I have a problem with a formmail script and it's been bugging me for weeks, so hopefully someone can help. I am relatively new to php and would definitely class myself as an absolute beginner, so while I've searched plenty of sites/posts/forums for help I have yet to find a solution. The issue is further compounded by the fact that I don't get any error messages. In fact, everything works perfectly except I receive no email via the form. I have recently learned that the host server is a Windows system and that this issue is relatively commonplace. I have pasted the script below so hopefully someone can help. But please, keep the helpful instructions in simple language Cheers, Paul. <?php ini_set("sendmail_from", "[email protected]"); $mailto = '[email protected]' ; $subject = "Quotes Form: All Conference Accessories website" ; $formurl = "http://www.conferenceaccessories.com/quotes.html" ; $errorurl = "http://www.conferenceaccessories.com/quotesformerror.html" ; $thankyouurl = "http://www.conferenceaccessories.com/success.html" ; $email_is_required = 1; $name_is_required = 1; $phone_is_required = 1; $daterequired_is_required = 1; $quantity_is_required = 1; $price_is_required = 1; $uself = 0; $use_envsender = 0; $use_webmaster_email_for_from = 0; $use_utf8 = 1; // -------------------- END OF CONFIGURABLE SECTION --------------- $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ; if (!isset( $use_envsender )) { $use_envsender = 0 ; } $envsender = "-f$mailto" ; $name = $_POST['name'] ; $email = $_POST['email'] ; $phone = $_POST['phone'] ; $companyname = $_POST['companyname'] ; $contactmethod = $_POST['contactmethod'] ; $daterequired = $_POST['daterequired'] ; $productcategory = $_POST['productcategory'] ; $productcode = $_POST['productcode'] ; $quantity = $_POST['quantity'] ; $price = $_POST['price'] ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } if ( ($email_is_required && (empty($email) || !ereg("@", $email))) || ($name_is_required && empty($name)) || ($phone_is_required && empty($phone)) || ($daterequired_is_required && empty($daterequired)) || ($quantity_is_required && empty($quantity)) || ($price_is_required && empty($price)) ) { header( "Location: $errorurl" ); exit ; } if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { header( "Location: $errorurl" ); exit ; } if (empty($email)) { $email = $mailto ; } $fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email : $mailto ; if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "Name of sender: $name\n" . "------------------------------------------------------------\n" . "Phone of sender: $phone\n" . "------------------------------------------------------------\n" . "Email of sender: $email\n" . "------------------------------------------------------------\n" . "Company name: $companyname\n" . "------------------------------------------------------------\n" . "Preferred contact method: $contactmethod\n" . "------------------------------------------------------------\n" . "Date products are required: $daterequired\n" . "------------------------------------------------------------\n" . "Product category: $productcategory\n" . "------------------------------------------------------------\n" . "Product code: $productcode\n" . "------------------------------------------------------------\n" . "Quantity required: $quantity\n" . "------------------------------------------------------------\n" . "Price/budget per unit: $price\n" . "\n\n------------------------------------------------------------\n" ; $headers = "From: \"$name\" <$fromemail>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.13.0" . $headersep . 'MIME-Version: 1.0' . $headersep . $content_type ; if ($use_envsender) { mail($mailto, $subject, $messageproper, $headers, $envsender ); } else { mail($mailto, $subject, $messageproper, $headers ); } header( "Location: $thankyouurl" ); exit ; ?> Link to comment https://forums.phpfreaks.com/topic/134002-help-with-php-formmail-script/ Share on other sites More sharing options...
cedartree Posted December 4, 2008 Share Posted December 4, 2008 I am using "EMAIL CLASS 2.0" you may want to give that a try...it worked on the first time for me Link to comment https://forums.phpfreaks.com/topic/134002-help-with-php-formmail-script/#findComment-706111 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.