v7‰PNG
IHDR Ÿ f Õ†C1 sRGB ®Îé gAMA ±üa pHYs à ÃÇo¨d GIDATx^íÜL”÷ð÷Yçªö("Bh_ò«®¸¢§q5kÖ*:þ0AºšÖ¥]VkJ¢M»¶f¸±8\k2íll£1]q®ÙÔ‚ÆT
To unsubscribe from our periodic e-mail messages, please click the following link
';
const UNSUBSCRIBE_TXT = '
-------------------------------------------------------------------
To unsubscribe from our periodic e-mail messages, please click the
following link:
%link%
-------------------------------------------------------------------
';
public function __construct($charset = 'utf-8')
{
parent::__construct($charset);
$this->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
}
public function setPeriodic($periodic){ $this->periodic = $periodic ; return $this; }
public function getPeriodic($periodic){ return $this->periodic; }
/** Should the e-mail be sent immediately, or it can be put to queue ? */
public function isInstant(){ return $this->periodic == self::USER_REQUESTED; }
/** @return int calculate from periodic+priority, bigger will stay higher in the queue and will be set faster */
public function getPriority(){ return (int)$this->priority + (int)$this->periodic;}
/** Set mail order in the queue, by default it will be set based on "periodic" */
public function setPriority($priority){ $this->priority = $priority; return $this; }
/**
* Add unsubscibe link of given type (see class constants)
* This must be called before adding e-mail body
* @param int $type
*/
public function addUnsubscribeLink($type = self::LINK_USER){
if ($this->_bodyText || $this->_bodyHtml)
throw new Am_Exception_InternalError("Body is already added, could not do " . __METHOD__);
$this->addUnsubscribeLink = $type;
}
public function clearUnsubscribeLink(){
if ($this->_bodyText || $this->_bodyHtml)
throw new Am_Exception_InternalError("Body is already added, could not do " . __METHOD__);
$this->addUnsubscribeLink = false;
}
/**
* @param string $content - will be modified
* @param bool $isHtml
* @return null
*/
protected function _addUnsubscribeLink(& $content, $isHtml){
if (!$this->addUnsubscribeLink) return ;
if (Am_Di::getInstance()->config->get('disable_unsubscribe_link')) return; //disabled at all
$e = @$this->_to[0];
if ($e=="") {
trigger_error("E-Mail address is empty in " . __METHOD__.", did you call addUnsubscribeLink before adding receipients?", E_USER_WARNING);
return; // no email address
}
$link = Am_Mail::getUnsubscribeLink($e, $this->addUnsubscribeLink);
if (!$this->listUnsubscribeAdded) {
$this->addHeader('List-Unsubscribe', sprintf('<%s>', $link));
$this->listUnsubscribeAdded = true;
}
if (strpos($content, $link)!==false) return; //already added
if ($isHtml) {
$out = Am_Di::getInstance()->config->get('unsubscribe_html', Am_Mail::UNSUBSCRIBE_HTML);
} else {
$out = Am_Di::getInstance()->config->get('unsubscribe_txt', Am_Mail::UNSUBSCRIBE_TXT);
}
$t = new Am_SimpleTemplate();
$t->assign('link', $link);
$out = "\r\n" . $t->render($out);
if (!$isHtml) {
$content .= "\r\n" . $out;
} else {
$content = str_ireplace('