Pimcore\Mail::addTo PHP Метод

addTo() публичный Метод

Adds To-header and recipient, $email can be an array, or a single string address Additionally adds recipients to temporary storage
public addTo ( string | array $email, string $name = '' ) : Mail
$email string | array
$name string
Результат Mail Provides fluent interface
    public function addTo($email, $name = '')
    {
        $this->addToTemporaryStorage('To', $email, $name);
        return parent::addTo($email, $name);
    }

Usage Example

 /**
  * Process OrderState for Order
  *
  * @param CoreShopOrder $order
  * @param null $locale
  * @return bool
  * @throws \Exception
  */
 public function processStep(CoreShopOrder $order, $locale = null)
 {
     $emailDocument = $this->getEmailDocument($locale);
     $emailParameters = array("order" => $order, "newOrderStatus" => $this, "user" => $order->getCustomer());
     if ($this->getAccepted()) {
     }
     if ($this->getShipped()) {
     }
     if ($this->getPaid()) {
         Plugin::actionHook("paymentConfirmation", array("order" => $order));
     }
     Plugin::actionHook("orderStatusUpdate", array("newOrderStatus" => $this, "order" => $order));
     if ($this->getEmail() && $emailDocument instanceof Document\Email) {
         $mail = new Mail();
         $mail->setDocument($emailDocument);
         $mail->setParams($emailParameters);
         $mail->addTo($order->getCustomer()->getEmail(), $order->getCustomer()->getFirstname() . " " . $order->getCustomer()->getLastname());
         Tool::addAdminToMail($mail);
         $mail->send();
     }
     $order->setOrderState($this);
     $order->save();
     return true;
     //TODO: Stock Management
 }
All Usage Examples Of Pimcore\Mail::addTo