/** * @param bool $testmail */ private function getBookingData($testmail = false) { if ($testmail) { $data = parent::s_booking_info(1, 1); } else { $this->addBooking(); $data = parent::s_booking_info($this->idprofil_session, magixglobal_model_db::layerDB()->lastInsert()); } if ($data != null) { if ($testmail) { $itemData = $this->setBookingData($data); } else { $itemData = $this->setBookingData($data); $email_customer = $data['email_pr']; //récupération des e-mail pour envois $core_mail = new magixglobal_model_mail('mail'); $getConfigData = $this->getConfigData(); $lotsOfRecipients = array($getConfigData['mail_order']); foreach ($lotsOfRecipients as $recipient) { $message = $core_mail->body_mail(self::setBookingMail(), array($email_customer), array($recipient), $itemData, false); $core_mail->batch_send_mail($message); } $msgClient = $core_mail->body_mail(self::setBookingMail(), array($getConfigData['mail_order_from']), array($email_customer), $itemData, false); $core_mail->batch_send_mail($msgClient); } } }
/** * Envoi du mail * Si return true retourne success.tpl * sinon retourne empty.tpl */ protected function send_email($create) { if (isset($this->email)) { $create->configLoad(); if (empty($this->lastname) or empty($this->firstname) or empty($this->email)) { $this->getNotify('warning', 'empty'); } elseif (!magixcjquery_filter_isVar::isMail($this->email)) { $this->getNotify('warning', 'mail'); } elseif (!empty($this->moreinfo)) { $this->getNotify('error', 'configured'); } else { if ($create->getLanguage()) { if (parent::c_show_table() != 0) { if (parent::s_contact($create->getLanguage()) != null) { //Instance la classe mail avec le paramètre de transport $core_mail = new magixglobal_model_mail('mail'); //Charge dans un tableau les utilisateurs qui reçoivent les mails $lotsOfRecipients = parent::s_contact($create->getLanguage()); //Initialisation du contenu du message foreach ($lotsOfRecipients as $recipient) { $message = $core_mail->body_mail(self::setTitleMail(), array($this->email), array($recipient['mail_contact']), self::getBodyMail(), false); $core_mail->batch_send_mail($message); } $this->getNotify('success'); } else { $this->getNotify('error', 'configured'); } } else { $this->getNotify('error', 'installed'); } } } } }