Unsupported scripts and control panel web app for a hosting company
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

messagemail.php 1.2KB

123456789101112131415161718192021222324252627282930313233
  1. <?PHP
  2. function messagemail ($message) {
  3. $sql = 'SELECT message_id, message_title, message_time, message_body, ';
  4. $sql .= 'message_type FROM messages WHERE message_id = '.$message;
  5. $res = mysql_query($sql);
  6. $row = mysql_fetch_array($res);
  7. $sql = 'SELECT user_email FROM users WHERE mail_announce = 1';
  8. if ($row['message_type'] == 'admin') {
  9. $sql .= ' AND user_admin = 1';
  10. }
  11. $res = mysql_query($sql);
  12. while ($usr = mysql_fetch_array($res)) {
  13. $to = $usr['user_email'];
  14. $subject = 'UTD-Hosting announcement: '.$row['message_title'];
  15. $body = 'This is an automated message. A new UTD-Hosting announcement ';
  16. $body .= 'has been posted. The announcement is displayed below for your ';
  17. $body .= 'convenience. To opt out of these messages, please log into the ';
  18. $body .= 'control panel at https://secure.utd-hosting.com/control/ and ';
  19. $body .= 'select the "User preferences" link.'."\n\n";
  20. $body .= ' ============ '.$row['message_title'].' ============';
  21. $body .= "\n\n".$row['message_body']."\n\n";
  22. $body .= ' ============ End of message ========= '."\n\n";
  23. $body .= "\n\n-- UTD-Hosting support";
  24. mail($to, $subject, $body, 'From: support@utd-hosting.com (UTD-Hosting support)');
  25. }
  26. }
  27. ?>