コード例 #1
0
 /**
  * @param $username //because we always write to somebody with oc nick
  * @param bool $automatically //if you don't want to add 'mail_auto_generated' text into footer - set it to false
  */
 public function addFooterAndHeader($username, $automatically = true)
 {
     $footer = new EmailFormatter(__DIR__ . "/../../tpl/stdstyle/email/ocFooter.email.html");
     $header = new EmailFormatter(__DIR__ . "/../../tpl/stdstyle/email/ocHeader.email.html");
     $footer->setVariable("octeamEmailsSignature", OcConfig::getOcteamEmailsSignature());
     if ($automatically) {
         $footer->setVariable("mail_auto_generated", tr("mail_auto_generated"));
     } else {
         $footer->setVariable("mail_auto_generated", "");
     }
     $header->setVariable("server", OcConfig::getAbsolute_server_URI());
     $header->setVariable("oc_logo", OcConfig::getHeaderLogo());
     $header->setVariable("sitename", OcConfig::getSiteName());
     $header->setVariable("short_sitename", OcConfig::getShortSiteName());
     $header->setVariable("welcome", tr("welcome"));
     $header->setVariable("user", $username);
     $this->emailContent = $header->getEmailContent() . $this->emailContent . $footer->getEmailContent();
 }
コード例 #2
0
ファイル: EmailSender.php プロジェクト: kojoty/opencaching-pl
 public static function sendRemoveLogNotification($emailTemplateFile, GeoCacheLog $log, User $loggedUser)
 {
     $formattedMessage = new EmailFormatter($emailTemplateFile);
     $formattedMessage->setVariable("log_owner", $log->getUser()->getUserName());
     $formattedMessage->setVariable("waypointId", $log->getGeoCache()->getWaypointId());
     $formattedMessage->setVariable("serviceUrl", OcConfig::getAbsolute_server_URI());
     $formattedMessage->setVariable("logRemover", $loggedUser->getUserName());
     $formattedMessage->setVariable("logRemoverId", $loggedUser->getUserId());
     $formattedMessage->setVariable("cache_name", $log->getGeoCache()->getCacheName());
     $formattedMessage->setVariable("log_entry", $log->getText());
     $formattedMessage->setVariable("removedLog_01", tr('removedLog_01'));
     $formattedMessage->setVariable("removedLog_02", tr('removedLog_02'));
     $formattedMessage->addFooterAndHeader($log->getUser()->getUserName());
     $email = new Email();
     $email->addToAddr($log->getUser()->getEmail());
     $email->setReplyToAddr(OcConfig::getNoreplyEmailAddress());
     $email->setFromAddr(OcConfig::getNoreplyEmailAddress());
     $email->setSubject(tr('removed_log_title'));
     $email->setBody($formattedMessage->getEmailContent(), true);
     $email->send();
 }