I need to send the order mail to people that are not the customer.
But the Order Sender doesn't send the email to more thant 1 person, why ?
use Magento\Sales\Model\Order\Email\Sender\OrderSender;
public function beforeExecute($subject, $observer)
{
$event = $observer->getEvent();
/** @var \Magento\Sales\Model\Order $order */
$order = $event->getOrder();
......
$condition = false;
if ($condition) {
$order->setCanSendNewEmailFlag(false);
}else{
$customer = $this->_customerSession->getCustomer();
if($customer->getGroupId() != "4"){
$contacts = $this->getContacts();
$contacts = array("mail@mail","other@mail");
$order->setCustomerEmail($contacts[0]);
$this->orderSender->send($order);
$order->setCustomerEmail($contacts[1]);
$this->orderSender->send($order);
}
}
die;
return [$observer];
}