protected function _afterInsert(Kwf_Model_Row_Interface $row)
 {
     parent::_afterInsert($row);
     $link = $this->getData()->url . '?key=' . $row->key;
     $mail = new Kwf_Mail_Template($this->getData());
     $mail->addTo($row->email);
     $mail->subject = $this->_getPlaceholder('subject');
     $mail->link = 'http://' . Kwf_Registry::get('config')->server->domain . $link;
     $mail->send();
 }
 protected function _afterInsert(Kwf_Model_Row_Interface $row)
 {
     parent::_afterInsert($row);
     $link = $this->getData()->getAbsoluteUrl() . '?key=' . $row->key;
     $mail = new Kwf_Mail_Template($this->getData());
     $mail->addTo($row->email);
     $mail->subject = $this->_getPlaceholder('subject');
     $mail->link = $link;
     $mail->send();
 }
 protected function _afterInsert(Kwf_Model_Row_Interface $row)
 {
     parent::_afterInsert($row);
     $pageName = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($row->component_id)->getParentPage()->name;
     $recipient = $this->_getRecipient();
     $user = $row->getParentRow('User');
     if ($recipient['email']) {
         $tpl = new Kwf_Mail_Template($this);
         $tpl->data = $this->getData();
         $tpl->text = $row->text;
         $tpl->pageName = $pageName;
         $tpl->user = $user;
         $tpl->addTo($recipient['email'], $recipient['name']);
         $tpl->setFrom($user->email, "{$user->firstname} {$user->lastname}");
         $tpl->setSubject($this->getData()->trlKwf('Feedback to page ') . $pageName);
         $tpl->send();
     }
 }
示例#4
0
 public function testMailSending()
 {
     $mockMail = $this->getMock('Kwf_Mail', array('send'));
     $c = $this->_root->getChildComponent('-both');
     $m = new Kwf_Mail_Template($c);
     $m->getView()->addScriptPath('.');
     $m->setMail($mockMail);
     $m->subject = 'a special subject';
     $m->foo = 'bar';
     $m->send();
     $this->assertEquals('a special subject', $m->getMail()->getSubject());
     $this->assertEquals('The foo variable is: bar', $m->getMail()->getBodyText(true));
     $this->assertEquals('The foo variable is:<br />bar', $m->getMail()->getBodyHtml(true));
 }