3 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4 * Copyright (C) 2002-2013 The Nucleus Group
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 * (see nucleus/documentation/index.html#license for more info)
12 * Class used to represent a collection of e-mail addresses, to which a
13 * message can be sent (e.g. comment or karma vote notification).
17 // array of addresses that need to get a notification
18 var $addresses = array();
21 * takes one string as argument, containing multiple e-mail addresses
22 * separated by semicolons
23 * eg: site@demuynck.org;nucleus@demuynck.org;foo@bar.com
25 function NOTIFICATION($addresses) {
26 $this->addresses = explode(';' , $addresses);
30 * returns true if all addresses are valid
32 function validAddresses() {
33 foreach ( $this->addresses as $address ) {
34 if (!isValidMailAddress(trim($address)))
41 * Sends email messages to all the email addresses
43 function notify($title, $message, $from) {
46 foreach ( $this->addresses as $address ) {
47 $address = trim($address);
52 // don't send messages to yourself
53 if ($member->isLoggedIn() && ($member->getEmail() == $address))
57 @mb_internal_encoding(_CHARSET);
58 @mb_send_mail($address, $title, $message, "From: ". $from);