Beispiel #1
0
 protected function sendEmail(Estimate $estimate)
 {
     $i18n = $this->getContext()->getI18N();
     $result = false;
     try {
         $message = new InvoiceMessage($estimate);
         if ($message->getReadyState()) {
             $result = $this->getMailer()->send($message);
             if ($result) {
                 $estimate->setSentByEmail(true);
                 $estimate->save();
             }
         }
     } catch (Exception $e) {
         $message = sprintf($i18n->__('There is a problem with estimate %s'), $estimate) . ': ' . $e->getMessage();
         $this->getUser()->error($message);
     }
     return $result;
 }