private void sendButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendButtonActionPerformed
        //disable all text fields
        dateTextField.setEditable(false);
        toTextField.setEditable(false);
        fromTextField.setEditable(false);
        subjectTextField.setEditable(false);
        bodyTextArea.setEditable(false);
        
        //get all the strings from the separate fields
        String date = dateTextField.getText();
        String to = toTextField.getText();
        String from = fromTextField.getText();
        String subject = subjectTextField.getText();
        String body = bodyTextArea.getText();
        String messagePassing = "";
        
        //if any of the fields are empty
        if(date.equals("") || to.equals("") || from.equals("") || subject.equals("") || body.equals("")){
            //show error dialog
            JOptionPane.showMessageDialog(this, "Missing Field(s)");
        }
        else{
            if(body.contains("\n")){
                String[] ditchNewline = body.split("\n");
                body = "";
                for(int i = 0; i < ditchNewline.length; i++){
                    body += ditchNewline[i];
                    body += " ";
                }
            }
            //add <br> tag between message fields
            messagePassing += date;
            messagePassing += "<separator>";
            messagePassing += to;
            messagePassing += "<separator>";
            messagePassing += from;
            messagePassing += "<separator>";
            messagePassing += subject;
            messagePassing += "<separator>";
            messagePassing += body;

            //append the <pushfile> command to the message
            messagePassing += "<pushfile>";
            
            //send formatted message to server
            out.println("" + messagePassing);
            
            //reset text fields
            dateTextField.setText("");
            toTextField.setText("");
            fromTextField.setText("");
            subjectTextField.setText("");
            bodyTextArea.setText("");
            sendButton.setEnabled(false);
            replyButton.setEnabled(false);
            deleteButton.setEnabled(false);
            
            if(isInInbox){
                // Refresh list
                out.println("getinbox");
                populateEmailList();
            }
            else if(isInSent){
                // Refresh list
                out.println("getsent");
                populateEmailList();
            }
        }
    }//GEN-LAST:event_sendButtonActionPerformed