Exemple #1
0
 public function __construct(array $options = null)
 {
     if (!is_array($options)) {
         $options = [];
     }
     if (empty($options["smtpServer"])) {
         $hostname = "localhost";
     } else {
         $hostname = $options["smtpServer"];
     }
     if ($hostname === "localhost") {
         $port = isset($options["local-port"]) ? $options["local-port"] : 25;
     } else {
         $port = isset($options["port"]) ? $options["port"] : 465;
     }
     $server = new Server($hostname, $port);
     if (!empty($options["username"]) || !empty($options["password"])) {
         $server->setCredentials($options["username"], $options["password"]);
     }
     if (!empty($options["encryption"])) {
         $server->setEncryptionMethod($options["encryption"]);
     }
     if (!empty($options["returnPath"])) {
         $server->setReturnPath($options["returnPath"]);
     }
     parent::__construct($server);
     if (!empty($options["fromAddress"])) {
         $this->setFromAddress($options["fromAddress"], $options["fromName"]);
     }
 }
 public function __construct($fromEmail, $message, $name = null, array $headers = [])
 {
     // If there's a name, add it to the subject
     if ($name) {
         $subject = $this->subject . ' from ' . $name;
     }
     parent::__construct($this->to, $fromEmail, $message, $subject);
 }
 /**
  * @param MemberProfilePage $page
  * @param Member $member
  */
 public function __construct($page, $member)
 {
     $from = $page->EmailFrom ? $page->EmailFrom : Email::getAdminEmail();
     $to = $member->Email;
     $subject = self::get_parsed_string($page->ApprovalEmailSubject, $member, $page);
     $body = self::get_parsed_string($page->ApprovalEmailTemplate, $member, $page);
     parent::__construct($from, $to, $subject, $body);
 }
 public function __construct($page, $member, $offers)
 {
     $from = $page->EmailFrom;
     $to = $member->Email;
     $subject = $page->NewOffersNewsletterSubject;
     parent::__construct($from, $to, $subject);
     $this->populateTemplate(new ArrayData(array('Member' => $member, 'TaskPage' => $page, 'Offers' => $offers, '$SiteName' => SiteConfig::current_site_config()->Title, '$LoginLink' => Director::absoluteURL(singleton('Security')->Link('login')))));
 }
 /**
  * @param Newsletter $newsletter
  * @param NewsletterType $type
  */
 function __construct($newsletter, $type = null)
 {
     $this->newsletter = $newsletter;
     $this->nlType = $type ? $type : $newsletter->getNewsletterType();
     parent::__construct();
     $this->body = $newsletter->getContentBody();
     $this->populateTemplate(new ArrayData(array('Newsletter' => $this->Newsletter, 'UnsubscribeLink' => $this->UnsubscribeLink())));
     $this->extend('updateNewsletterEmail', $this);
 }
 /**
  * @param Newsletter $newsletter
  * @param Mailinglists $recipient
  * @param Boolean $fakeRecipient
  */
 function __construct($newsletter, $recipient, $fakeRecipient = false)
 {
     $this->newsletter = $newsletter;
     $this->mailinglists = $newsletter->MailingLists();
     $this->recipient = $recipient;
     $this->fakeRecipient = $fakeRecipient;
     parent::__construct($this->newsletter->SendFrom, $this->recipient->Email);
     $this->populateTemplate(new ArrayData(array('UnsubscribeLink' => $this->UnsubscribeLink(), 'SiteConfig' => DataObject::get_one('SiteConfig'), 'AbsoluteBaseURL' => Director::absoluteBaseURLWithAuth())));
     $this->body = $newsletter->getContentBody();
     $this->subject = $newsletter->Subject;
     $this->ss_template = $newsletter->RenderTemplate;
     if ($this->body && $this->newsletter) {
         $text = $this->body->forTemplate();
         //Recipient Fields ShortCode parsing
         $bodyViewer = new SSViewer_FromString($text);
         $text = $bodyViewer->process($this->templateData());
         // Install link tracking by replacing existing links with "newsletterlink" and hash-based reference.
         if ($this->config()->link_tracking_enabled && !$this->fakeRecipient && preg_match_all("/<a\\s[^>]*href=\"([^\"]*)\"[^>]*>(.*)<\\/a>/siU", $text, $matches)) {
             if (isset($matches[1]) && ($links = $matches[1])) {
                 $titles = isset($matches[2]) ? $matches[2] : array();
                 $id = (int) $this->newsletter->ID;
                 $replacements = array();
                 $current = array();
                 // workaround as we want to match the longest urls (/foo/bar/baz) before /foo/
                 array_unique($links);
                 $sorted = array_combine($links, array_map('strlen', $links));
                 arsort($sorted);
                 foreach ($sorted as $link => $length) {
                     $SQL_link = Convert::raw2sql($link);
                     $tracked = DataObject::get_one('Newsletter_TrackedLink', "\"NewsletterID\" = '" . $id . "' AND \"Original\" = '" . $SQL_link . "'");
                     if (!$tracked) {
                         // make one.
                         $tracked = new Newsletter_TrackedLink();
                         $tracked->Original = $link;
                         $tracked->NewsletterID = $id;
                         $tracked->write();
                     }
                     // replace the link
                     $replacements[$link] = $tracked->Link();
                     // track that this link is still active
                     $current[] = $tracked->ID;
                 }
                 // replace the strings
                 $text = str_ireplace(array_keys($replacements), array_values($replacements), $text);
             }
         }
         // replace the body
         $output = new HTMLText();
         $output->setValue($text);
         $this->body = $output;
     }
 }
 public function __construct($member = null)
 {
     $member = $member ? $member : Member::currentUser();
     $link = Director::absoluteBaseUrl();
     $host = parse_url($link, PHP_URL_HOST);
     $this->subject = _t('WelcomeEmail.SUBJECT', "Welcome to {Website}", 'Email subject', ['Website' => SiteConfig::current_site_config()->Title]);
     if ($member) {
         $this->to = $member->Email;
         if ($member->FirstName) {
             $name = trim($member->FirstName . ' ' . $member->Surname);
             $this->to = $name . ' <' . $member->Email . '>';
         }
     }
     parent::__construct();
     $this->populateTemplate(new ArrayData(['Member' => $member, 'AbsoluteWebsiteLink' => $link, 'WebsiteLink' => $host]));
 }
 public function __construct($content)
 {
     //Email is not set as on - none shall pass...
     if (!$this->config()->enable_email) {
         return;
     }
     //Check for a to and throw error if none set.
     if (!$this->config()->email_to) {
         user_error("You have not set an 'email_to' in the config", E_USER_ERROR);
         return;
     }
     $from = Config::inst()->get('Email', 'admin_email');
     $to = $this->config()->email_to;
     $subject = "Suspected spammer: Please review";
     parent::__construct($from, $to, $subject);
     $this->populateTemplate(new ArrayData(array('Content' => $content)));
 }
 public function __construct($from = null, $to = null, $subject = null, $body = null, $bounceHandlerURL = null, $cc = null, $bcc = null)
 {
     parent::__construct($from, $to, $subject, $body, $bounceHandlerURL, $cc, $bcc);
     // Use config template
     if ($defaultTemplate = self::config()->default_template) {
         $this->setTemplate($defaultTemplate);
     }
     // Allow subclass template
     $class = get_called_class();
     if ($class != 'MandrillEmail') {
         $this->ss_template = array('email/' . $class, $this->ss_template);
     }
     // Allow user configurable theming
     $config = SiteConfig::current_site_config();
     if ($config->EmailTheme) {
         $this->setTheme($config->EmailTheme);
     } elseif ($theme = self::config()->default_theme) {
         $this->setTheme($theme);
     }
 }
Exemple #10
0
 function __construct()
 {
     parent::__construct();
     $this->subject = _t('Member.SUBJECTPASSWORDRESET', "Your password reset link", PR_MEDIUM, 'Email subject');
 }
 /**
  * __construct
  *
  * @param \Never5\LicenseWP\License\License $license
  * @param string $first_name
  */
 public function __construct($license, $first_name)
 {
     $subject = sprintf('Your %s license keys', get_bloginfo('name'));
     parent::__construct($subject, 'new-license-email.php', array('license' => $license, 'user_first_name' => $first_name, 'email_heading' => $subject));
 }
	function __construct() {
		parent::__construct();
	}
 public function __construct($submittedFields = null)
 {
     parent::__construct($submittedFields = null);
 }
Exemple #14
0
 /**
  * Constructor
  * @param object $db
  */
 public function __construct(&$db)
 {
     $this->db =& $db;
     $this->smTextObject = new TableText($this->db);
     parent::__construct();
 }
Exemple #15
0
 public function __construct($from = null, $to = null, $subject = null, $body = null, $bounceHandlerURL = null, $cc = null, $bcc = null)
 {
     parent::__construct($from, $to, $subject, $body, $bounceHandlerURL, $cc, $bcc);
     user_error('Email_Template is deprecated. Please use Email instead.', E_USER_NOTICE);
 }
 function __construct()
 {
     parent::__construct();
     $this->subject = _t('Member.SUBJECTUSERNAME', "Your username", PR_MEDIUM, 'Email subject');
 }
 public function __construct()
 {
     require_once "postmark-php/Postmark.php";
     parent::__construct();
 }
Exemple #18
0
 public function __construct($spam = false)
 {
     parent::__construct();
     $this->spam = $spam;
 }
 public function __construct($from = null, $to = null, $subject = null, $body = null, $plaintext_body = null, $bounceHandlerURL = null, $cc = null, $bcc = null)
 {
     parent::__construct($from, $to, $subject, $body, $bounceHandlerURL, $cc, $bcc);
     $this->plaintext_body = $plaintext_body;
 }
 /**
  * __construct
  *
  * @param string $subject
  * @param string $body
  * @param \Never5\LicenseWP\License\License $license
  */
 public function __construct($subject, $body, $license)
 {
     parent::__construct($subject, 'expiring-license-email.php', array('body' => $body, 'license' => $license, 'email_heading' => $subject));
 }
 public function __construct()
 {
     parent::__construct();
     $this->subject = _t('Member.SUBJECTPASSWORDCHANGED', "Your password has been changed", 'Email subject');
 }