/** * @param string $verbName * @param CM_Model_User|int $actor * @param int $typeEmail */ public function __construct($verbName, $actor, $typeEmail) { parent::__construct($verbName, $actor); $typeEmail = (int) $typeEmail; try { $className = CM_Mail_Mailable::_getClassName($typeEmail); $this->_nameEmail = ucwords(CM_Util::uncamelize(str_replace('_', '', preg_replace('#\\A[^_]++_[^_]++_#', '', $className)), ' ')); } catch (CM_Class_Exception_TypeNotConfiguredException $exception) { CM_Service_Manager::getInstance()->getLogger()->warning('Unrecognized mail type when creating mail action', (new CM_Log_Context())->setException($exception)); $this->_nameEmail = (string) $typeEmail; } }
public function testGetSiteRecipient() { $site = $this->getMockSite(); $recipient = $this->getMockUser('*****@*****.**', $site); $mail = new CM_Mail_Mailable($recipient); $this->assertEquals($site, $mail->getSite()); }
/** * @param CM_Mail_Mailable $mail * @return string * @throws CM_Exception_Invalid */ public function getUrlEmailTracking(CM_Mail_Mailable $mail) { if (!$mail->getRecipient()) { throw new CM_Exception_Invalid('Needs user'); } $params = array('user' => $mail->getRecipient()->getId(), 'mailType' => $mail->getType()); return CM_Util::link($this->getSite()->getUrl() . '/emailtracking', $params); }