Ok i have worked out some code for a baisic email form...
create a new page using the code module with permissions for the group that you want to see and use the form. then past this code in there! this isn't fully tested but will send an email out to all users that are in the database.
I wanted to use a text box for the imput form but i was having a problem where the end tage for the text box i wanted to create (even though it was escaped in ' ' was conflicting with the text box used to input stuff in the code module which caused complete chaos!
$dflt_emailaddress = ''; // This can be left blank or filled in exp 'test@test.com'
$dflt_name = '!'; // This can be left blank or filled in exp 'web master'
if ($_REQUEST['codeblock'] == false){
echo '<form method=GET action="'.$_SERVER[PHP_SELF].'">
<input type="text" name="from_address" size="20" maxlength="200" value="'.$dflt_emailaddress.'">From: email address example (
email@email.com)
<br><input type="text" name="from_name" size="20" maxlength="200" value="'.$dflt_name.'">From: email Name example (Website Greetings)
<br><input type="text" name="subject" size="20" maxlength="200">Subject:<br><br>
Enter Message:<br><input type="text" name="text" size="80"><br>
<input type="hidden" name="codeblock" value="sendemail">
<input type="submit" value="Submit">
</form>';
}
if ($_REQUEST['codeblock'] == 'sendemail'){
echo 'Email\'s are being sent out Please wait untill you are notified that the script is finished<br>';
$query = "SELECT * FROM ".TABLE_PREFIX."users";
$results = $database->query($query);
while($setting = $results->fetchRow()) {
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
/* additional headers */
$headers .= "To: ".$setting['display_name']." <".$setting['email'].">\r\n";
$headers .= "From: ".$_REQUEST['from_name']." <".$_REQUEST['from_address'].">\r\n";
$headers .= "\r\n";
$headers .= "\r\n";
// disabled while script is finalized
mail($_REQUEST['from_address'], $_REQUEST['subject'], $_REQUEST['text'], $headers);
}
echo '<br><br><br><strong>All Email\'s were sent out, it is safe to do somethign else!</strong><br>';
}