{
                global $ilAccess;
                
                
                $this->
setTitle($this->lng->txt(
'compose'));
                $this->subject = 
new ilTextInputGUI($this->lng->txt(
'subject'), 
'm_subject');
                $this->subject->setRequired(true);
                $this->sendtype->addOption(
new ilCheckboxOption($this->lng->txt(
"not_sent_only"), 1, 
''));
                $this->sendtype->addOption(
new ilCheckboxOption($this->lng->txt(
"send_to_unanswered"), 3, 
''));
                $this->sendtype->addOption(
new ilCheckboxOption($this->lng->txt(
"send_to_answered"), 2, 
''));
                $existingdata = $this->guiclass->object->getExternalCodeRecipients();
                $existingcolumns = array();
                if (count($existingdata))
                {
                        $first = array_shift($existingdata);
                        foreach ($first as $key => $value)
                        {
                                if (strcmp($key, 'code') != 0 && strcmp($key, 'email') != 0 && strcmp($key, 'sent') != 0) array_push($existingcolumns, '[' . $key . ']');
                        }
                }
                global $ilUser;
                $settings = $this->guiclass->object->getUserSettings($ilUser->getId(), 'savemessage');
                if (count($settings))
                {
                        $options = array(0 => $this->lng->txt('please_select'));
                        foreach ($settings as $setting)
                        {
                                $options[$setting['settings_id']] = $setting['title'];
                        }
                        $this->savedmessages = 
new ilSelectInputGUI($this->lng->txt(
"saved_messages"), 
"savedmessage");
                        $this->
addItem($this->savedmessages);
                }
                $this->mailmessage = 
new ilTextAreaInputGUI($this->lng->txt(
'message_content'), 
'm_message');
                $this->mailmessage->setCols(80);
                $this->mailmessage->setRows(10);
                $this->mailmessage->setInfo(sprintf($this->lng->txt('message_content_info'), join($existingcolumns, ', ')));
                $this->
addItem($this->mailmessage);
                
                $this->savemessage->setOptionTitle($this->lng->txt("save_reuse_message"));
                $this->savemessage->setValue(1);
                $this->savemessagetitle = 
new ilTextInputGUI($this->lng->txt(
'save_reuse_title'), 
'savemessagetitle');
                $this->savemessagetitle->
setSize(60);
                $this->savemessage->addSubItem($this->savemessagetitle);
                $this->
addItem($this->savemessage);
                if (count($settings))
                {
                        if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
"ref_id"])) $this->
addCommandButton(
"deleteSavedMessage", $this->lng->txt(
"delete_saved_message"));
 
                        if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
"ref_id"])) $this->
addCommandButton(
"insertSavedMessage", $this->lng->txt(
"insert_saved_message"));
 
                }
                if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
"ref_id"])) $this->
addCommandButton(
"sendCodesMail", $this->lng->txt(
"send"));
 
        }