Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. public function index() {
  2.  
  3. if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
  4.  
  5. $mail = new Mail();
  6. $mail->protocol = $this->config->get('config_mail_protocol');
  7. $mail->parameter = $this->config->get('config_mail_parameter');
  8. $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
  9. $mail->smtp_username = $this->config->get('config_mail_smtp_username');
  10. $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
  11. $mail->smtp_port = $this->config->get('config_mail_smtp_port');
  12. $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
  13.  
  14. $mail->setTo($this->config->get('config_email'));
  15. $mail->setFrom($this->request->post['email']);
  16. $mail->setSender(html_entity_decode($this->request->post['name'], ENT_QUOTES, 'UTF-8'));
  17. $mail->setSubject("Новый индивидуальный заказ от " . $this->request->post['name']);
  18.  
  19. $messageHtml = "
  20. <table>
  21.  
  22. <tr>
  23. <th><h1>Заказ от</h1></th> <th><h1>" . $this->request->post['name'] . "</h1></th></tr>
  24. <tr>
  25. <th><label>Номер телефона:</th><th> " . $this->request->post['phone'] . "</label></th></tr>
  26. <tr>
  27. <th><label>Email заказчика:</th><th> " . $this->request->post['email'] . "</label></th></tr>
  28. <tr>
  29. <th><label>Товар: </th><th>" . $this->request->post['product_name'] . "</label></th></tr>
  30. <th><label>Текст заказа</label></th><td colspan='1'>
  31. <span>" . $this->request->post['order_description'] . "</span></td></tr>
  32. </table>
  33. ";
  34.  
  35. $mail->setHtml($messageHtml);
  36. $mail->send();
  37.  
  38. $mail2 = new Mail();
  39. $mail2->protocol = $this->config->get('config_mail_protocol');
  40. $mail2->parameter = $this->config->get('config_mail_parameter');
  41. $mail2->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
  42. $mail2->smtp_username = $this->config->get('config_mail_smtp_username');
  43. $mail2->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
  44. $mail2->smtp_port = $this->config->get('config_mail_smtp_port');
  45. $mail2->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
  46. $mail2->setTo($this->request->post['email']);
  47. $mail2->setFrom($this->config->get('config_email'));
  48. $mail2->setSender(html_entity_decode($this->request->post['name'], ENT_QUOTES, 'UTF-8'));
  49. $mail2->setSubject($this->request->post['name'] . " ваш заказ оформлен!");
  50. $messageHtml2 = "Что-то отправляем клиенту";
  51. $mail2->setHtml($messageHtml2);
  52. $mail2->send();
  53.  
  54.  
  55. $this->response->redirect($this->url->link('information/custom_order/success'));
  56. }
  57. if (isset($this->request->post['product_id'])) {
  58. $this->response->redirect($this->url->link('product/product&product_id=' . $this->request->post['product_id']));
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement