getstock Posted February 22, 2010 Share Posted February 22, 2010 Hi All, I am guessing that this is the suspect code: /* Add a new message for the current order and send an e-mail to the customer if needed */ elseif (isset($_POST['submitMessage'])) { $_GET['view'.$this->table] = true; if ($this->tabAccess['edit'] === '1') { if (!($id_order = intval(Tools::getValue('id_order'))) OR !($id_customer = intval(Tools::getValue('id_customer')))) $this->_errors[] = Tools::displayError('an error occurred before sending message'); elseif (!Tools::getValue('message')) $this->_errors[] = Tools::displayError('message cannot be blank'); else { /* Get message rules and and check fields validity */ $rules = call_user_func(array('Message', 'getValidationRules'), 'Message'); foreach ($rules['required'] AS $field) if (($value = Tools::getValue($field)) == false AND (string)$value != '0') if (!Tools::getValue('id_'.$this->table) OR $field != 'passwd') $this->_errors[] = Tools::displayError('field').' '.$field.' '.Tools::displayError('is required'); foreach ($rules['size'] AS $field => $maxLength) if (Tools::getValue($field) AND Tools::strlen(Tools::getValue($field)) > $maxLength) $this->_errors[] = Tools::displayError('field').' '.$field.' '.Tools::displayError('is too long').' ('.$maxLength.' '.Tools::displayError('chars max').')'; foreach ($rules['validate'] AS $field => $function) if (Tools::getValue($field)) if (!Validate::$function(htmlentities(Tools::getValue($field), ENT_COMPAT, 'UTF-8'))) $this->_errors[] = Tools::displayError('field').' '.$field.' '.Tools::displayError('is invalid'); if (!sizeof($this->_errors)) { $message = new Message(); $message->id_employee = intval($cookie->id_employee); $message->message = htmlentities(Tools::getValue('message'), ENT_COMPAT, 'UTF-8'); $message->id_order = $id_order; $message->private = Tools::getValue('visibility'); if (!$message->add()) $this->_errors[] = Tools::displayError('an error occurred while sending message'); elseif ($message->private) Tools::redirectAdmin($currentIndex.'&id;_order='.$id_order.'&vieworder&conf;=11'.'&token;='.$this->token); elseif (Validate::isLoadedObject($customer = new Customer($id_customer))) { $order = new Order(intval($message->id_order)); if (Validate::isLoadedObject($order)) { $title = html_entity_decode($this->l('New message regarding your order').' '.$message->id_order, ENT_NOQUOTES, 'UTF-8'); $varsTpl = array('{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{id_order}' => $message->id_order, '{message}' => (Configuration::get('PS_MAIL_TYPE') == 2 ? $message->message : nl2br2($message->message))); if (Mail::Send(intval($order->id_lang), 'order_merchant_comment', $title, $varsTpl, $customer->email, $customer->firstname.' '.$customer->lastname)) Tools::redirectAdmin($currentIndex.'&id;_order='.$id_order.'&vieworder&conf;=11'.'&token;='.$this->token); } } $this->_errors[] = Tools::displayError('an error occurred while sending e-mail to the customer'); } } } else $this->_errors[] = Tools::displayError('You do not have permission to delete here.'); } The error I am getting is $this->_errors[] = Tools::displayError('an error occurred while sending e-mail to the customer');Is there a way to check for errors here like in adding to database in php/mysql?Cheers Link to comment Share on other sites More sharing options...
uddhava Posted February 23, 2010 Share Posted February 23, 2010 Can you send emails in any way?Does the contact form work?Do you use php mail or SMTP ?Questions questions Link to comment Share on other sites More sharing options...
getstock Posted February 23, 2010 Author Share Posted February 23, 2010 Hi mate,I am using smtp, and the contact form works, its just the ones in the back office Link to comment Share on other sites More sharing options...
uddhava Posted February 23, 2010 Share Posted February 23, 2010 Can you describe how you get this error (in detail) Link to comment Share on other sites More sharing options...
getstock Posted February 23, 2010 Author Share Posted February 23, 2010 I look at the customers account, and on the left hand side near the bottom is the box for sending a customer a message. I am trying to send the default one (about out of stock) as a test. Once I click send, the page refreshes, and at the top the error 'an error occurred while sending e-mail to the customer’ appears an the email is not received. Thanks for your help Link to comment Share on other sites More sharing options...
uddhava Posted February 23, 2010 Share Posted February 23, 2010 i guess you are not the only one.I also cannot send by sMTPThere is a bug filed for this : http://www.prestashop.com/bug_tracker/view/3636/ Link to comment Share on other sites More sharing options...
Eddan Posted May 19, 2011 Share Posted May 19, 2011 I have this problem also, i can send testmails through php mail and i can receive the testmail also, but when i´m trying to send through the BO ordermessage field I receive the error "an error occurred while sending e-mail to the customer" and no email is being sentI run on PS 1,3,7 does any1 know a solution for this? Link to comment Share on other sites More sharing options...
kamisetafutbol Posted January 2, 2013 Share Posted January 2, 2013 I have this problem also, i can send testmails through php mail and i can receive the testmail also, but when i´m trying to send through the BO ordermessage field I receive the error "an error occurred while sending e-mail to the customer" and no email is being sent I run on PS 1,3,7 does any1 know a solution for this? did you fix it? Link to comment Share on other sites More sharing options...
Recommended Posts