Guest Posted March 27, 2007 Posted March 27, 2007 Hello, I just discovered that the Autoresponder I set up on my server through DirectAdmin is not sending the Autoresponse out to Contact Us form submittors. I do receive the Autoresponce if I email the address directly but not through the Contact Us form, so I'm sure the Autoresponder is set up correctly on my server. I have heavily modified the Contact Us page code as shown below with Anti-Spam Enhancement and IP Recorder contributions and do not know if that is causing the problem or not. Under Email Options, I have E-Mail Transport Method set to sendmail and Send E-Mails set to true. I have tried setting E-Mail Transport Method to smtp but that did not appear to fix the problem. I also tried removing the IP Recorder portion of the code and that did not appear to fix the problem. I have read every forum thread available on the subject of autoresponders and autoreplys to no avail. If you know of a solution to my problem, please let me know. Please let me know if you need additional information. Thanks in advance for your help! Dick The code I currently have in contact_us.php is as follows: require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US); $error = false; if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send') && tep_email_isfromdomain($_POST['email'])) { $error = true; $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_ISFROMDOMAIN_ERROR); } elseif (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) { $name = tep_db_prepare_input($HTTP_POST_VARS['name']); $email_address = tep_db_prepare_input($HTTP_POST_VARS['email']); //IP recorder start $ipaddress = $HTTP_SERVER_VARS["REMOTE_ADDR"]; $ip = "\n\nIP Address: " . $ipaddress; $content = $HTTP_POST_VARS['enquiry']; $content_ip = $content . $ip; $enquiry = tep_db_prepare_input($content_ip); //IP recorder end // BOF Super Contact us enhancement 1.0 $emailsubject = tep_db_prepare_input($HTTP_POST_VARS['reason']) . ' ' . EMAIL_SUBJECT; if (tep_validate_email($email_address)) { if (CONTACT_US_LIST !=''){ $send_to_array=explode("," ,CONTACT_US_LIST); preg_match('/\<[^>]+\>/', $send_to_array[$send_to], $send_email_array); $send_to_email= eregi_replace (">", "", $send_email_array[0]); $send_to_email= eregi_replace ("<", "", $send_to_email); tep_mail(preg_replace('/\<[^*]*/', '', $send_to_array[$send_to]), $send_to_email, $emailsubject, $enquiry, $name, $email_address, $company); }else{ tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $emailsubject, $enquiry, $name, $email_address, $company); } // EOF Super Contact us enhancement 1.0 tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success')); } else { $error = true; $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); } } and in includes/functions/general.php my tep_mail function is: function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address) { if (SEND_EMAILS != 'true') return false; // Instantiate a new mail object $message = new email(array('X-Mailer: osCommerce Mailer')); // Build the text version $text = strip_tags($email_text); if (EMAIL_USE_HTML == 'true') { $message->add_html($email_text, $text); } else { $message->add_text($text); } // Send message $message->build_message(); $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject); } //// // Check if product has attributes function tep_has_product_attributes($products_id) { $attributes_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "'"); $attributes = tep_db_fetch_array($attributes_query); if ($attributes['count'] > 0) { return true; } else { return false; } } Any help would be greatly appreciated!
♥Vger Posted April 3, 2007 Posted April 3, 2007 This is not going to work. The auto-responder works directly off the mail box. The contact_us form is a php script which uses sendmail - and goes out in the name of that email address. If you put a simple email link on that page in place of the contact_us from then the auto-responder will work. Vger
Guest Posted April 4, 2007 Posted April 4, 2007 Vger, Thank you very much for the reply, information and helpful suggestion. Unfortunately, because I would loose the ability to collect the IP Address of the sender, I am not in favor of simply replacing the Contact Form with an email link and hope to find another solution. I see that there is a contribution called "Edit Auto-Emails From Admin Backend" which also creates an option for an auto-response to be sent from the "Contact Us" Page, which I will investigate. If you, or anyone else, has any experience with this contribution, or any other possible solutions to my problem, please let me know. Thanks again for all your help! Dick This is not going to work. The auto-responder works directly off the mail box. The contact_us form is a php script which uses sendmail - and goes out in the name of that email address. If you put a simple email link on that page in place of the contact_us from then the auto-responder will work. Vger
Guest Posted April 4, 2007 Posted April 4, 2007 Hello, I installation instructions for the Contact Us page portion of the "Edit Auto-Emails From Admin Backend" contribution specify... catalog/contact_us.php //FIND: // if (tep_validate_email($email_address)) { tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address); // //ADD BELOW: if(SEND_CONTACT_US_RESPONSE=='true') tep_mail($name, $email_address, CONTACT_US_RESPONSE_EMAIL_SUBJECT, CONTACT_US_RESPONSE_EMAIL_TEXT."\n\n-------------------------Your Message:\n".$enquiry, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); ...but that was written for the original catalog/contact_us.php script as shown below... require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US); $error = false; if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) { $name = tep_db_prepare_input($HTTP_POST_VARS['name']); $email_address = tep_db_prepare_input($HTTP_POST_VARS['email']); $enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']); if (tep_validate_email($email_address)) { tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address); tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success')); } else { $error = true; $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); } } $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CONTACT_US)); ...and not for my heavily modifed catalog/contact_us.php script as shown here: require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US); $error = false; if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send') && tep_email_isfromdomain($_POST['email'])) { $error = true; $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_ISFROMDOMAIN_ERROR); } elseif (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) { $name = tep_db_prepare_input($HTTP_POST_VARS['name']); $email_address = tep_db_prepare_input($HTTP_POST_VARS['email']); //IP recorder start $ipaddress = $HTTP_SERVER_VARS["REMOTE_ADDR"]; $ip = "\n\nIP Address: " . $ipaddress; $content = $HTTP_POST_VARS['enquiry']; $content_ip = $content . $ip; $enquiry = tep_db_prepare_input($content_ip); //IP recorder end // BOF Super Contact us enhancement 1.0 $emailsubject = tep_db_prepare_input($HTTP_POST_VARS['reason']) . ' ' . EMAIL_SUBJECT; if (tep_validate_email($email_address)) { if (CONTACT_US_LIST !=''){ $send_to_array=explode("," ,CONTACT_US_LIST); preg_match('/\<[^>]+\>/', $send_to_array[$send_to], $send_email_array); $send_to_email= eregi_replace (">", "", $send_email_array[0]); $send_to_email= eregi_replace ("<", "", $send_to_email); tep_mail(preg_replace('/\<[^*]*/', '', $send_to_array[$send_to]), $send_to_email, $emailsubject, $enquiry, $name, $email_address, $company); }else{ tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $emailsubject, $enquiry, $name, $email_address, $company); } // EOF Super Contact us enhancement 1.0 tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success')); } else { $error = true; $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); } } $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CONTACT_US)); When I attempt to incorporate the instructed change into my modified script as shown below... require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US); $error = false; if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send') && tep_email_isfromdomain($_POST['email'])) { $error = true; $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_ISFROMDOMAIN_ERROR); } elseif (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) { $name = tep_db_prepare_input($HTTP_POST_VARS['name']); $email_address = tep_db_prepare_input($HTTP_POST_VARS['email']); //IP recorder start $ipaddress = $HTTP_SERVER_VARS["REMOTE_ADDR"]; $ip = "\n\nIP Address: " . $ipaddress; $content = $HTTP_POST_VARS['enquiry']; $content_ip = $content . $ip; $enquiry = tep_db_prepare_input($content_ip); //IP recorder end // BOF Super Contact us enhancement 1.0 $emailsubject = tep_db_prepare_input($HTTP_POST_VARS['reason']) . ' ' . EMAIL_SUBJECT; if (tep_validate_email($email_address)) { if (CONTACT_US_LIST !=''){ $send_to_array=explode("," ,CONTACT_US_LIST); preg_match('/\<[^>]+\>/', $send_to_array[$send_to], $send_email_array); $send_to_email= eregi_replace (">", "", $send_email_array[0]); $send_to_email= eregi_replace ("<", "", $send_to_email); tep_mail(preg_replace('/\<[^*]*/', '', $send_to_array[$send_to]), $send_to_email, $emailsubject, $enquiry, $name, $email_address, $company); if(SEND_CONTACT_US_RESPONSE=='true') tep_mail($name, $email_address, CONTACT_US_RESPONSE_EMAIL_SUBJECT, CONTACT_US_RESPONSE_EMAIL_TEXT."\n\n-------------------------Your Message:\n".$enquiry, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); }else{ tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $emailsubject, $enquiry, $name, $email_address, $company); } // EOF Super Contact us enhancement 1.0 tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success')); } else { $error = true; $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); } } $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CONTACT_US)); ...no autoresponder email is sent. I must not have the new contributions code integrated into my modified code correctly. Does anyone see where my mistake is? I did run the SQL file portion of the installation process beforehand as well. There is also a thread about the contribution here: http://www.oscommerce.com/forums/index.php?sho...mp;#entry641706 Any help would be greatly apppreciated. Regards, Dick
♥Vger Posted April 4, 2007 Posted April 4, 2007 Did you use Win Merge to manage the merger of your edited file with the file supplied by the contrib? Vger
Guest Posted April 4, 2007 Posted April 4, 2007 Vger, Thanks for the reply. No, I simply copied and pasted the new section of code where I interpreted the instructions said to, even though my modified code was significantly different than the original code. The contribution did not actually come with a merge able file but only the textual instructions or I would heve used my Beyond Compare 2 application. Thanks in advance for your help. Regards, Dick Did you use Win Merge to manage the merger of your edited file with the file supplied by the contrib? Vger
Guest Posted April 4, 2007 Posted April 4, 2007 Vger, Thanks for the nudge. I went back to the catalog/contact_us.php script and relocated the new code and sure enough, it is sending autoresponse emails now. Thank you for all your help! Dick Did you use Win Merge to manage the merger of your edited file with the file supplied by the contrib? Vger In case anyone might need the working code, it is provided below. require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US); $error = false; if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send') && tep_email_isfromdomain($_POST['email'])) { $error = true; $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_ISFROMDOMAIN_ERROR); } elseif (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) { $name = tep_db_prepare_input($HTTP_POST_VARS['name']); $email_address = tep_db_prepare_input($HTTP_POST_VARS['email']); //IP recorder start $ipaddress = $HTTP_SERVER_VARS["REMOTE_ADDR"]; $ip = "\n\nIP Address: " . $ipaddress; $content = $HTTP_POST_VARS['enquiry']; $content_ip = $content . $ip; $enquiry = tep_db_prepare_input($content_ip); //IP recorder end // BOF Super Contact us enhancement 1.0 $emailsubject = tep_db_prepare_input($HTTP_POST_VARS['reason']) . ' ' . EMAIL_SUBJECT; if (tep_validate_email($email_address)) { if (CONTACT_US_LIST !=''){ $send_to_array=explode("," ,CONTACT_US_LIST); preg_match('/\<[^>]+\>/', $send_to_array[$send_to], $send_email_array); $send_to_email= eregi_replace (">", "", $send_email_array[0]); $send_to_email= eregi_replace ("<", "", $send_to_email); tep_mail(preg_replace('/\<[^*]*/', '', $send_to_array[$send_to]), $send_to_email, $emailsubject, $enquiry, $name, $email_address, $company); }else{ tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $emailsubject, $enquiry, $name, $email_address, $company); } // EOF Super Contact us enhancement 1.0 // BOF Edit Auto-Emails From Admin Backend if(SEND_CONTACT_US_RESPONSE=='true') tep_mail($name, $email_address, CONTACT_US_RESPONSE_EMAIL_SUBJECT, CONTACT_US_RESPONSE_EMAIL_TEXT."\n\n-------------------------Your Message:\n".$enquiry, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); // EOF Edit Auto-Emails From Admin Backend tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success')); } else { $error = true; $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); } } $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CONTACT_US));
Recommended Posts
Archived
This topic is now archived and is closed to further replies.