Answer the question
In order to leave comments, you need to log in
Sending an order from the basket to two mails, how to do it?
Hello, I'm trying to send an order from the basket to two mails, one mail is taken from the site settings with settings from the table, and I want to register the other manually.
But not how it doesn't work.
$this->session->delete('tovary');
$settings = ORM::factory('setting')->find();
// отправляем сообщение на email
$config = Kohana::$config->load('email');
Email::connect($config);
//получатель
$to = "[email protected]";
// заголовок письма
$subject = "Новый заказ с сайта ".$url."";
// отправитель
$from = '[email protected]';
// само письмо в html
$message = "" . $table;
$full = ($total['total'] + $pm->cost + $del->cost);
$emails = explode(",", $settings->emails);
$this->action_send_messsge(trim($data['phone']), $full, $inv_id);
if (is_array($emails) AND $settings->send_order) {
foreach ($emails as $email) {
if (!empty($email)) {
$email = trim($email);
// код который отправляет, рабочий
Email::send($email, $from, $to, $subject, true);
echo $table;
if ($pm->is_robo == 1) {
$link = Chronopay::factory();
$this->request->redirect($link->get_link($full, $inv_id));
} elseif ($pm->id == 3) {
$this->request->redirect("/cart/bank/$inv_id/$full");
}
}
}
} else {
if ($settings->send_order) {
//mail($user->email,$subject,$message,$to);
}
}
}
$this->request->redirect("/cart/done");
} else {
$this->request->redirect("/");
}
}
Answer the question
In order to leave comments, you need to log in
I understood the essence of the work a little, added
$sender = explode(",", $orders->sender);
also added to the $sender field
in this field
Email::send($email, $sender, $from, $subject, $message, true);
When ordering, an error occurs, if you remove one of $email, $sender, then everything works, that is, it does not want to leave for two mails. how to be I do not know.
The error is like this:
set up a redirect from the main mail. it is much more efficient for you in this case.
You, my friend, have nothing in the From array by the time the command is executed, as we can see.
Perhaps you are looking for a problem in the script, but it is not in this file at all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question