groupId)?NULL:group_by_id($thread->groupId); if( !$email ) { $errors[] = no_field("form.field.email"); } else if( !is_valid_email($email)) { $errors[] = wrong_field("form.field.email"); } if( count($errors) > 0 ) { $page['formemail'] = $email; $page['chat.thread.id'] = $thread->id; $page['chat.thread.token'] = $thread->lastToken; $page['level'] = ""; $page = array_merge_recursive( $page, setup_logo($group) ); expand("styles/dialogs", getchatstyle(), "mail.tpl"); exit; } $history = ""; $last_id = -1; $messages = $thread->getMessages(true, $last_id); foreach ($messages as $msg) { $history .= message_to_text($msg); } $subject = getstring("mail.user.history.subject"); $body = getstring2( "mail.user.history.body", array($thread->userName, $history, Settings::get('title'), Settings::get('hosturl')) ); webim_mail($email, $webim_mailbox, $subject, $body); $page = array_merge_recursive( $page, setup_logo($group) ); expand("styles/dialogs", getchatstyle(), "mailsent.tpl"); exit; ?>