VERSION 5.00
Object = "{1DF3AFED-47E0-4474-9900-954B8FD24E86}#1.0#0"; "ChilkatMail.dll"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form_Mail 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Envío de Correo"
   ClientHeight    =   3840
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   9435
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3840
   ScaleWidth      =   9435
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton Command2 
      Caption         =   "&Cancelar"
      Height          =   435
      Left            =   7860
      TabIndex        =   10
      Top             =   2100
      Width           =   1455
   End
   Begin VB.CommandButton Btn_Lim 
      Caption         =   "&Limpiar"
      Height          =   435
      Left            =   7860
      TabIndex        =   9
      Top             =   1560
      Width           =   1455
   End
   Begin VB.ComboBox Cmb_svr_Mail 
      Height          =   315
      ItemData        =   "Form_mail.frx":0000
      Left            =   3000
      List            =   "Form_mail.frx":0007
      Style           =   2  'Dropdown List
      TabIndex        =   1
      Top             =   120
      Width           =   1695
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   7980
      Top             =   3000
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton cmdAttach 
      Caption         =   "&Adjuntar archivo"
      Height          =   435
      Left            =   7860
      TabIndex        =   8
      Top             =   1020
      Width           =   1455
   End
   Begin VB.TextBox Txt_arc_adj 
      Enabled         =   0   'False
      Height          =   285
      Left            =   3000
      TabIndex        =   6
      Top             =   3360
      Width           =   4455
   End
   Begin VB.CommandButton cmdSend 
      Caption         =   "&Enviar"
      Height          =   435
      Left            =   7860
      TabIndex        =   7
      Top             =   420
      Width           =   1455
   End
   Begin VB.Frame Frame1 
      Caption         =   "Contenido"
      Height          =   1575
      Left            =   1740
      TabIndex        =   14
      Top             =   1560
      Width           =   5715
      Begin VB.TextBox Txt_Contenido 
         Height          =   1215
         Left            =   120
         MultiLine       =   -1  'True
         ScrollBars      =   3  'Both
         TabIndex        =   5
         Top             =   240
         Width           =   5475
      End
   End
   Begin VB.TextBox Txt_Asunto 
      Height          =   285
      Left            =   3000
      TabIndex        =   4
      Top             =   1185
      Width           =   4395
   End
   Begin VB.TextBox Txt_De 
      Height          =   285
      Left            =   3000
      TabIndex        =   3
      Top             =   825
      Width           =   4395
   End
   Begin VB.TextBox Txt_Para 
      Height          =   285
      Left            =   3000
      TabIndex        =   2
      Top             =   465
      Width           =   4395
   End
   Begin CHILKATMAILLibCtl.ChilkatMailMan ChilkatMailMan1 
      Left            =   8640
      OleObjectBlob   =   "Form_mail.frx":0018
      Top             =   3000
   End
   Begin VB.Image Image1 
      Height          =   3600
      Left            =   120
      Picture         =   "Form_mail.frx":0116
      Top             =   120
      Width           =   1500
   End
   Begin VB.Label Label5 
      Caption         =   "Archivo Adjunto"
      Height          =   255
      Left            =   1740
      TabIndex        =   15
      Top             =   3360
      Width           =   1215
   End
   Begin VB.Label Label4 
      Caption         =   "Asunto:"
      Height          =   255
      Left            =   1800
      TabIndex        =   13
      Top             =   1185
      Width           =   915
   End
   Begin VB.Label Label3 
      Caption         =   "De:"
      Height          =   255
      Left            =   1800
      TabIndex        =   12
      Top             =   825
      Width           =   915
   End
   Begin VB.Label Label2 
      Caption         =   "Para:"
      Height          =   255
      Left            =   1800
      TabIndex        =   11
      Top             =   465
      Width           =   915
   End
   Begin VB.Label Label1 
      Caption         =   "Mailserver"
      Height          =   285
      Left            =   1800
      TabIndex        =   0
      Top             =   150
      Width           =   915
   End
End
Attribute VB_Name = "Form_Mail"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' SMTP (Send mail) example
'
' Created by Jonas Gauffin (http://surf.to/VbArea)
'
' This example will get updated. Check VbArea for updates
'
' This version only supports Textfile attachments
'
'
'

Dim filename As String

Private Sub Btn_Lim_Click()
Me.Txt_Para = ""
Me.Txt_De = ""
Me.Txt_Asunto = ""
Me.Txt_Contenido = ""
Me.Txt_arc_adj = ""
End Sub

Private Sub cmdAttach_Click()
    'filename = DialogFile(Me.hWnd, "", "All Files|*.*", App.Path, "")
    CommonDialog1.Action = 1
    Txt_arc_adj = CommonDialog1.filename
End Sub

Private Sub sckMail_Close()
    sckMail.Close
    Debug.Print "close"
End Sub

Private Sub sckMail_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
    Debug.Print Description
    
End Sub



Private Sub cmdSend_Click()
On Error GoTo controler
If Me.Txt_Para = "" Then MsgBox "Falta información esencial para completar la operación.", vbExclamation + vbOKOnly, "Advertencia": Me.Txt_Para.SetFocus: Exit Sub
If Me.Txt_De = "" Then MsgBox "Falta información esencial para completar la operación.", vbExclamation + vbOKOnly, "Advertencia": Me.Txt_De.SetFocus: Exit Sub
If Me.Txt_Asunto = "" Then MsgBox "Falta información esencial para completar la operación.", vbExclamation + vbOKOnly, "Advertencia": Me.Txt_Asunto.SetFocus: Exit Sub
If Me.Txt_Contenido = "" Then MsgBox "Falta información esencial para completar la operación.", vbExclamation + vbOKOnly, "Advertencia": Me.Txt_Contenido.SetFocus: Exit Sub


    
    ChilkatMailMan1.SmtpHost = Me.Cmb_svr_Mail.Text
    Set email = New ChilkatEmail
    email.AddTo "", Me.Txt_Para '"Luis", "lcisternas@farfana"
    email.Subject = Me.Txt_Asunto
    email.Body = Me.Txt_Contenido
    email.From = Me.Txt_De
    If Me.Txt_arc_adj <> "" Then email.AddFileAttachment Me.Txt_arc_adj
    ChilkatMailMan1.SendEmail email
    Set email = Nothing
    a = "El e-mail:" & Chr$(13) & "Asunto :" & Me.Txt_Asunto & Chr$(13) & "De     :" & Me.Txt_De & Chr$(13) & "Para  :" & Me.Txt_Para & Chr$(13) & Chr$(13) & "Fue enviado exitosamente."
    MsgBox a, vbInformation + vbOKOnly, "Envío de e-mail"
    Me.Txt_Para = ""
    Me.Txt_De = ""
    Me.Txt_Asunto = ""
    Me.Txt_Contenido = ""
    Me.Txt_arc_adj = ""
    
    
    
Exit Sub
controler:
If Err.Number = -2147467259 Then MsgBox "Alguno de los datos en su e-mail es incorrecto." & Chr$(13) & "Corríjalo y vuelva a intenmtarlo.", vbCritical, "Error en el e-mail"

End Sub

Private Sub Command2_Click()
Me.Txt_Para = ""
Me.Txt_De = ""
Me.Txt_Asunto = ""
Me.Txt_Contenido = ""
Me.Txt_arc_adj = ""

Unload Me
End Sub

Private Sub txtNoMail_Change()
Dim a%

    For a = 1 To Len(txtNoMail.Text)
        Debug.Print Asc(Mid(txtNoMail.Text, a, 1))
    Next
        
End Sub

Private Sub Form_Load()
    CentrarForma Me
    Form_Mail.Width = 9525
    Form_Mail.Height = 4215
    
    Me.Cmb_svr_Mail.ListIndex = 0
    ChilkatMailMan1.UnlockComponent "BaldEagle"
End Sub



Private Sub Form_Unload(Cancel As Integer)
Call menuhabilitado(True)
End Sub
