
Imports System.Runtime.InteropServices

Public Class frmMail
#Region "Mov. Pantalla"
    <DllImport("user32.Dll", EntryPoint:="ReleaseCapture")>
    Private Shared Sub ReleaseCapture()

    End Sub

    <DllImport("user32.Dll", EntryPoint:="SendMessage")>
    Private Shared Sub SendMessage(hWnd As IntPtr, wMsg As Integer, wParam As Integer, lParam As Integer)

    End Sub

#End Region

    Private Sub btnCerrar_Click(sender As Object, e As EventArgs) Handles btnCerrar.Click
        Me.Close()
    End Sub

    Private Sub PanelBarraTitulo_MouseMove(sender As Object, e As MouseEventArgs) Handles PanelBarraTitulo.MouseMove
        ReleaseCapture()
        SendMessage(Me.Handle, &H112&, &HF012&, 0)
    End Sub

    Private Sub frmMail_MouseMove(sender As Object, e As MouseEventArgs) Handles MyBase.MouseMove
        ReleaseCapture()
        SendMessage(Me.Handle, &H112&, &HF012&, 0)
    End Sub

    Private Sub btnEnviar_Click(sender As Object, e As EventArgs) Handles btnEnviar.Click
        If Para.Text = "" Or Asunto.Text = "" Or Mensaje.Text = "" Then
            MsgBox("Atención!, Falta uno de los campos: Para / Asunto / Mensaje", MsgBoxStyle.Critical, "Mensaje del Sistema")
            Exit Sub

        End If

        If Adjunto2.Text = "C:\IRGodam\PDFS\nodata.txt" Then
            EnviarCorreo(Para.Text, Mensaje.Text, Adjunto1.Text, Asunto.Text, "admin@godamexpress.com", "Acceso@2022+.")
        Else
            EnviarCorreoDOSAdj(Para.Text, Mensaje.Text, Adjunto1.Text, Adjunto2.Text, Asunto.Text, "admin@godamexpress.com", "Acceso@2022+.")
        End If
        Me.Close()
    End Sub

    Private Sub btnPath2_Click(sender As Object, e As EventArgs) Handles btnPath2.Click
        With OpenFileDialog2
            .InitialDirectory = "C:\IRGodam\PDFS"
            .Filter = "All Files|*.*|Bitmaps|*.bmp|GIFs|*.gif|JPEGs|*.jpg|PNGs|*.png|PDFs|*.pdf"
            .FilterIndex = 1
        End With

        If OpenFileDialog2.ShowDialog() = DialogResult.OK Then
            Adjunto2.Text = OpenFileDialog2.FileName
        Else
            Exit Sub

        End If
    End Sub

    Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click
        Me.Adjunto2.Text = "C:\IRGodam\PDFS\nodata.txt"
    End Sub
End Class