- if ((EXT_IS_ACTIVE("msg")) && ($_POST['type'] == "msg"))
- {
- // Add message
- $msg = LOAD_EMAIL_TEMPLATE("admins_msg_contct_admin", $_POST['text'], "0");
- SEND_ADMIN_MESSAGE($_GET['admin'], ADMINS_MSG_FROM_ADMIN, $msg);
- }
- else
- {
- // Load admin's email address
- $result = SQL_QUERY_ESC("SELECT email FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
- array(bigintval($_GET['admin'])), __FILE__, __LINE__);
- list($email) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
+ // Load admin's email address
+ $email = getAdminEmail(bigintval(getRequestParameter('admin')));
+
+ // Load email template and send the mail to the admin
+ $message = loadEmailTemplate('admins_mail_contct_admin', postRequestParameter('text'), 0);
+ sendEmail($email, '{--ADMIN_ADMINS_MESSAGE_FROM_ADMIN--}', $message);