summaryrefslogtreecommitdiff
path: root/utils/mail.php
diff options
context:
space:
mode:
authordeva <deva>2010-02-26 16:12:36 +0000
committerdeva <deva>2010-02-26 16:12:36 +0000
commit78a0f0a00650c9a5e3c4d4cadcacc409919067ea (patch)
tree3b30f64b7b6d4608102d5672cba9b7ec0c00dbc4 /utils/mail.php
parenta741351d5c91913f22255b8e9e5d4586c70735d6 (diff)
Add pressrelease module. Make lots of codesharing with the newsletter module.
Diffstat (limited to 'utils/mail.php')
-rw-r--r--utils/mail.php68
1 files changed, 68 insertions, 0 deletions
diff --git a/utils/mail.php b/utils/mail.php
index 866bad4..e681d21 100644
--- a/utils/mail.php
+++ b/utils/mail.php
@@ -22,4 +22,72 @@ class Email {
}
}
+class _Mailinglist {
+ public $mailinglist = array();
+ public $subj_prefix;
+ public $sender;
+ public $replyto;
+ public $footer;
+
+ public function add($email) {
+ $key = $email->email;
+ if(array_key_exists($key, $this->mailinglist)) return false;
+ $this->mailinglist[$key] = $email;
+ return true;
+ }
+
+ public function remove($email) {
+ if(array_key_exists($email, $this->mailinglist)) {
+ unset($this->mailinglist[$email]);
+ return true;
+ }
+ return false;
+ }
+
+ public function postSingle($email, $subject, $message)
+ {
+ $subject = "[".$this->subj_prefix."] " . $subject;
+ $message .= "\n\n".$this->footer;
+ $email->send($subject, $message, $this->sender, $this->replyto);
+ }
+
+ public function post($subject, $message)
+ {
+ $sz = sizeof($this->mailinglist);
+
+ echo "<div style=\"text-align: center; padding-top: 120px; padding-bottom: 100px; position: absolute; top: 25%; left: 0px; width: 99.4%; height: 150px; border: solid #0000ff 3px; background: #fff; color: #000;\">Sending ". $sz ." mails <br/>\n&lt;";
+ ob_flush();
+ flush();
+
+ $num = 0;
+ $lvl = 0;
+ $steps = floor($sz / 10) + 1;
+
+ foreach($this->mailinglist as $email) {
+
+ $this->postSingle($email, $ubject, $message);
+
+ $pct = $num / $sz * 100;
+ if($pct >= $lvl) {
+ printf("<font style=\"font-size: 9px;\">%.0f%%</font>", $lvl);
+ $lvl += 100/$steps;
+ } else {
+ echo ".";
+ }
+ ob_flush();
+ flush();
+ $num++;
+ }
+ echo "<font style=\"font-size: 9px;\">[100%]</font>&gt;\n<br/>done<br/>\n";
+ echo "<a style=\"font-size: 20px; font-weight: bold;\" href=\"?page=admin>[CLOSE]</a>";
+ echo "</div>\n";
+ ob_flush();
+ flush();
+ }
+
+ public function _Mailinglist()
+ {
+ }
+}
+
?> \ No newline at end of file