/** * Prepare the email message. */ public function processEmail() { $this->count = 1; $mail = new Swift_Message(); $mail->setContentType('text/plain'); $mail->setCharset('utf-8'); if ($this->getOption('use_complete_template', true)) { $mail->setBody(sprintf(<<<EOF ------ %s - %s ------ %s ------ EOF , $this->options['name'], $this->options['email'], $this->options['message'])); } else { $mail->setBody($this->options['message']); } $mail->setSender(array(sfPlop::get('sf_plop_messaging_from_email') => sfPlop::get('sf_plop_messaging_from_name'))); $mail->setFrom(array($this->options['email'] => $this->options['name'])); if ($this->getOption('copy')) { $mail->setCc(array($this->options['email'] => $this->options['name'])); $this->count++; } if (is_integer($this->getOption('receiver'))) { $receiver = sfGuardUserProfilePeer::retrieveByPK($this->getOption('receiver')); if ($receiver) { $mail->setTo(array($receiver->getEmail() => $receiver->getFullName())); } else { $mail->setTo(array(sfPlop::get('sf_plop_messaging_to_email') => sfPlop::get('sf_plop_messaging_to_name'))); } } else { $mail->setTo(array(sfPlop::get('sf_plop_messaging_to_email') => sfPlop::get('sf_plop_messaging_to_name'))); } if ($this->getOption('subject')) { $mail->setSubject($this->getOption('subject')); } else { $mail->setSubject(sfPlop::get('sf_plop_messaging_subject')); } $this->mail = $mail; }