juniorprg Posted February 13, 2007 Share Posted February 13, 2007 I dont know if any changes that i did is creating this problem, but im getting 2 emails from same customer when contacted thru contact us page here is the code for the contact us page 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']); $telephone = tep_db_prepare_input($HTTP_POST_VARS['telephone']); $enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']); $sender_type = tep_db_prepare_input($HTTP_POST_VARS['sendertype']); if (strlen($name)<3) { $error = true; $messageStack->add('contact', ENTRY_NAME_CHECK_ERROR); } if (!tep_validate_email($email_address)) { $error = true; $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); } if (strlen($telephone)<10) { $error = true; $messageStack->add('contact', ENTRY_TELEPHONE_ERROR); } if ($enquiry == '') { $error = true; $messageStack->add('contact', ENTRY_ENQUIRY_CHECK_ERROR); } if ($error == false) { // add IP address and preamble text to message body $enquiry = sprintf(EMAIL_PREAMBLE_TEXT, $sender_type) . " " . tep_get_ip_address() . "\n-----------------------------------\n". "Name : ".$name ."\n"."Email Address : ".$email_address."\n"."Telephone No. : ".$telephone."\n"."Message : ".$enquiry . "\n----------------------------------------------\n"; if (defined('CONTACT_US_LIST') && (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); // append sender type to subject line tep_mail(preg_replace('/\<[^*]*/', '', $send_to_array[$send_to]), $send_to_email, $sender_type . " " . EMAIL_SUBJECT, $enquiry, $name, $email_address); }else{ tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $sender_type . " " . EMAIL_SUBJECT, $enquiry, $name, $email_address); } tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success')); } } $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CONTACT_US)); l8ter Link to comment Share on other sites More sharing options...
juniorprg Posted February 14, 2007 Author Share Posted February 14, 2007 anyone there please give me a hand.... l8ter Link to comment Share on other sites More sharing options...
ozzieshopper Posted February 14, 2007 Share Posted February 14, 2007 anyone there please give me a hand.... Hi, I'm no expert (far from it) but would like to see you find a solution to this problem. Could I ask what the purpose of this is? "\n Is it used as a line break? I have been searching these forums a fair bit the past couple of days and I have a tendency to read into other posts which sound interesting, if I remember correctly, I read that the use of "\n was not appropriate in php and to either use <p></p> or <br> for a line break. This may be totally irrelevant as to why you receive 2 emails but I have come to learn that the simplest error in php (and osc) can cause it to do weird things.... If this has nothing to do with what is causing your problem then feel free to put me in my place if you wish! :'( Cheers Ros Link to comment Share on other sites More sharing options...
juniorprg Posted February 14, 2007 Author Share Posted February 14, 2007 hi ros, that \n is for line break actually but now i noticed that every email send from this store is send twice, when a customer places an order it goes twice and also if i add extra email address for sending orders in the admin, that also goes twice.. so i believe its somthing to do with the over all email control coding.. and im not sure if that control is done at catalog/classes/email.php or is there any other file that im missing.... which i might have screw it over.... l8ter Link to comment Share on other sites More sharing options...
ozzieshopper Posted February 14, 2007 Share Posted February 14, 2007 hi ros,that \n is for line break actually but now i noticed that every email send from this store is send twice, when a customer places an order it goes twice and also if i add extra email address for sending orders in the admin, that also goes twice.. so i believe its somthing to do with the over all email control coding.. and im not sure if that control is done at catalog/classes/email.php or is there any other file that im missing.... which i might have screw it over.... I just had a look through the folders and files in file manager to see if there was a file you are missing, there seems to be only 2 that relate to email that I could locate and they are email.php and validate.php, I wondered if there was a send.php or sendit.php but couldn't locate any under those file names,. I'm sorry that I am unable to help you, possibly someone else will come along that can help, when you do find out what's causing the duplication please do post the results here, I would be interested to find out the cause of this. Cheers Ros Link to comment Share on other sites More sharing options...
juniorprg Posted February 14, 2007 Author Share Posted February 14, 2007 i appreciate your help, sure i will post the remedy when i find one... also where is this validate.php file located. I want to have a look at it too.... i just realized tat every file send from this store is send twice, i.e from tell_a_friend, invoiceorders, contact us and from admin contacting costumer...weird....! l8ter Link to comment Share on other sites More sharing options...
juniorprg Posted February 14, 2007 Author Share Posted February 14, 2007 i know what the issue is but dont know where to fix it, when i send a email from contact page and when i receive in outlook express or in yahoo the To: field has email address twice written which is why i'm getting 2 emails l8ter Link to comment Share on other sites More sharing options...
vicspain Posted February 14, 2007 Share Posted February 14, 2007 i know what the issue is but dont know where to fix it, when i send a email from contact page and when i receive in outlook express or in yahoo the To: field has email address twice written which is why i'm getting 2 emails I just downloaded and installed osCommerce yesterday and I haven't made any PHP modifications and I get 2 emails for an ordcer confirmation. The only things I've done is begin to modify the categories and products. Sorry not much help but at least it indicates that it should have nothing to do with your mods. Vic Link to comment Share on other sites More sharing options...
juniorprg Posted February 14, 2007 Author Share Posted February 14, 2007 is your Send extra order emails field empty too? its located in admin page under configuration>mystore l8ter Link to comment Share on other sites More sharing options...
juniorprg Posted February 14, 2007 Author Share Posted February 14, 2007 is your Send extra order emails field empty too? its located in admin page under configuration>mystore Seems like I found a cure for this.. i dont believe this is the best solution for this problem but what i did was from catalog/includes/classes/email.php find this line $to = (($to_name != '') ? '"' . $to_name . '" <' . $to_addr . '>' : $to_addr); and comment that out so it will be // $to = (($to_name != '') ? '"' . $to_name . '" <' . $to_addr . '>' : $to_addr); this will fix the error, and if your admin emails are also sending twice, you have to do the same in admin/includes/classes/email.php if anyone things this is wrong please let me know...but this works l8ter Link to comment Share on other sites More sharing options...
ozzieshopper Posted February 16, 2007 Share Posted February 16, 2007 Seems like I found a cure for this.. i dont believe this is the best solution for this problem but what i did was from catalog/includes/classes/email.php find this line $to = (($to_name != '') ? '"' . $to_name . '" <' . $to_addr . '>' : $to_addr); and comment that out so it will be // $to = (($to_name != '') ? '"' . $to_name . '" <' . $to_addr . '>' : $to_addr); this will fix the error, and if your admin emails are also sending twice, you have to do the same in admin/includes/classes/email.php if anyone things this is wrong please let me know...but this works It's good to see you found a solution for this problem, and if it works then that's great, sorry I was unable to help and thanks for sharing your solution with us... Cheers Ros Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.