3 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4 * Copyright (C) 2002-2009 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)
13 * Class used to represent a collection of e-mail addresses, to which a
14 * message can be sent (e.g. comment or karma vote notification).
16 * @license http://nucleuscms.org/license.txt GNU General Public License
17 * @copyright Copyright (C) 2002-2009 The Nucleus Group
19 * $NucleusJP: NOTIFICATION.php,v 1.6 2006/07/17 20:03:44 kimitake Exp $
23 // array of addresses that need to get a notification
24 var $addresses = array();
27 * takes one string as argument, containing multiple e-mail addresses
28 * separated by semicolons
29 * eg: site@demuynck.org;nucleus@demuynck.org;foo@bar.com
31 function NOTIFICATION($addresses) {
32 $this->addresses = explode(';' , $addresses);
36 * returns true if all addresses are valid
38 function validAddresses() {
39 foreach ( $this->addresses as $address ) {
40 if (!isValidMailAddress(trim($address)))
47 * Sends email messages to all the email addresses
49 function notify($title, $message, $from) {
52 foreach ( $this->addresses as $address ) {
53 $address = trim($address);
58 // don't send messages to yourself
59 if ($member->isLoggedIn() && ($member->getEmail() == $address))
63 @mb_internal_encoding(_CHARSET);
64 @mb_send_mail($address, $title, $message, "From: ". $from);