internal/functions/client/New-ClientMessage.ps1

function New-ClientMessage
{
    [CmdletBinding()]
    Param (
        $Reply
    )
    
    $script:newmsgform = new-object System.Windows.Forms.form
    $script:newmsgform.Text = "New Message"
    $script:newmsgform.size = new-object System.Drawing.Size(1000, 800)
    
    # Add Message To Lable
    $miMessageTolableBox = new-object System.Windows.Forms.Label
    $miMessageTolableBox.Location = new-object System.Drawing.Size(20, 20)
    $miMessageTolableBox.size = new-object System.Drawing.Size(80, 20)
    $miMessageTolableBox.Text = "To"
    $script:newmsgform.controls.Add($miMessageTolableBox)
    
    # Add Message Subject Lable
    $miMessageSubjectlableBox = new-object System.Windows.Forms.Label
    $miMessageSubjectlableBox.Location = new-object System.Drawing.Size(20, 65)
    $miMessageSubjectlableBox.size = new-object System.Drawing.Size(80, 20)
    $miMessageSubjectlableBox.Text = "Subject"
    $script:newmsgform.controls.Add($miMessageSubjectlableBox)
    
    # Add Message To
    $miMessageTotextlabelBox = new-object System.Windows.Forms.TextBox
    $miMessageTotextlabelBox.Location = new-object System.Drawing.Size(100, 20)
    $miMessageTotextlabelBox.size = new-object System.Drawing.Size(400, 20)
    $script:newmsgform.controls.Add($miMessageTotextlabelBox)
    
    # Add Message Subject
    $miMessageSubjecttextlabelBox = new-object System.Windows.Forms.TextBox
    $miMessageSubjecttextlabelBox.Location = new-object System.Drawing.Size(100, 65)
    $miMessageSubjecttextlabelBox.size = new-object System.Drawing.Size(600, 20)
    $script:newmsgform.controls.Add($miMessageSubjecttextlabelBox)
    
    
    # Add Message body
    $miMessageBodytextlabelBox = new-object System.Windows.Forms.RichTextBox
    $miMessageBodytextlabelBox.Location = new-object System.Drawing.Size(100, 100)
    $miMessageBodytextlabelBox.size = new-object System.Drawing.Size(600, 350)
    $script:newmsgform.controls.Add($miMessageBodytextlabelBox)
    
    # Add Message Attachments Lable
    $miMessageAttachmentslableBox = new-object System.Windows.Forms.Label
    $miMessageAttachmentslableBox.Location = new-object System.Drawing.Size(20, 460)
    $miMessageAttachmentslableBox.size = new-object System.Drawing.Size(80, 20)
    $miMessageAttachmentslableBox.Text = "Attachments"
    $script:newmsgform.controls.Add($miMessageAttachmentslableBox)
    
    $miMessageAttachmentslableBox1 = new-object System.Windows.Forms.Label
    $miMessageAttachmentslableBox1.Location = new-object System.Drawing.Size(100, 460)
    $miMessageAttachmentslableBox1.size = new-object System.Drawing.Size(600, 20)
    $miMessageAttachmentslableBox1.Text = ""
    $script:newmsgform.Controls.Add($miMessageAttachmentslableBox1)
    
    $exButton7 = new-object System.Windows.Forms.Button
    $exButton7.Location = new-object System.Drawing.Size(95, 520)
    $exButton7.Size = new-object System.Drawing.Size(125, 20)
    $exButton7.Text = "Send Message"
    $exButton7.Add_Click({ Send-ClientMessage })
    $script:newmsgform.Controls.Add($exButton7)
    
    $exButton4 = new-object System.Windows.Forms.Button
    $exButton4.Location = new-object System.Drawing.Size(95, 490)
    $exButton4.Size = new-object System.Drawing.Size(150, 20)
    $exButton4.Text = "Add Attachment"
    $exButton4.Enabled = $true
    $exButton4.Add_Click({ Select-ClientAttachment })
    
    $script:Attachments = @()
    
    $script:newmsgform.Controls.Add($exButton4)
    $script:newmsgform.autoscroll = $true
    $script:newmsgform.Add_Shown({ $Script:form.Activate() })
    $script:newmsgform.ShowDialog()    
}