public function commit() { $mail = new FrankizMailer(); $sub = $this->type_mail == 'promo' ? 'promo' : $this->formation->label(); $mail->subject('[Mail ' . $sub . '] ' . $this->subject); if ($this->origin) { global $globals; $mail->setFrom($this->origin->name() . '@' . $globals->mails->group_suffix, 'Frankiz - ' . $this->origin->label() . ''); } else { $mail->setFrom($this->writer->bestEmail(), $this->writer->fullName()); } if ($this->type_mail == 'promo' && !$this->targets) { $uf = new UserFilter(new PFC_AND(new UFC_Group($this->formation), new UFC_Group(Group::from('on_platal')))); } else { if ($this->type_mail == 'promo') { $uf = new UserFilter(new PFC_AND(new UFC_Group($this->formation), new UFC_Caste($this->targets), new UFC_Group(Group::from('on_platal')))); } else { $uf = new UserFilter(new PFC_AND(new UFC_Caste($this->targets->first()), new UFC_Group(Group::from('on_platal')))); } } if (!$this->nowiki) { $mail->body(MiniWiki::wikiToHTML($this->body, false)); } else { $mail->body(MiniWiki::wikiToText($this->body, false, 0, 80)); } $mail->ToUserFilter($uf); $mail->sendLater(!$this->nowiki); return true; }