home *** CD-ROM | disk | FTP | other *** search
/ IT.SOFT 22 / ITSOFTCD_22.iso / pc / shareware22 / file2 / MAILLITE.ZIP / TestMailLite.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-04-11  |  14.6 KB  |  473 lines

  1. VERSION 5.00
  2. Object = "{6395F295-D138-11D1-A6B4-00AA002075DA}#1.0#0"; "MAILLITE.OCX"
  3. Begin VB.Form TestMailLite 
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Test MailLite"
  6.    ClientHeight    =   6930
  7.    ClientLeft      =   2490
  8.    ClientTop       =   1155
  9.    ClientWidth     =   7335
  10.    Icon            =   "TestMailLite.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   6930
  15.    ScaleWidth      =   7335
  16.    Begin MailLitePrj.MailLite MailLite1 
  17.       Left            =   6120
  18.       Top             =   2580
  19.       _ExtentX        =   847
  20.       _ExtentY        =   847
  21.       UserHeaders     =   ""
  22.       SenderEmail     =   ""
  23.       RecipientEmail  =   ""
  24.       CarbonCopyEmail =   ""
  25.       EmailSubject    =   ""
  26.       EmailBody       =   ""
  27.       HostNameSmtp    =   ""
  28.       HostNamePop3    =   ""
  29.       SenderName      =   ""
  30.       RecipientName   =   ""
  31.       CarbonCopyName  =   ""
  32.       UserAccount     =   ""
  33.       UserPassword    =   ""
  34.       EmailPath       =   ""
  35.       EmailFilter     =   ""
  36.    End
  37.    Begin VB.TextBox EmailFilter 
  38.       Height          =   315
  39.       IMEMode         =   3  'DISABLE
  40.       Left            =   960
  41.       TabIndex        =   3
  42.       Top             =   1380
  43.       Width           =   3075
  44.    End
  45.    Begin VB.TextBox EmailUIDL 
  46.       Height          =   315
  47.       Left            =   960
  48.       Locked          =   -1  'True
  49.       TabIndex        =   7
  50.       TabStop         =   0   'False
  51.       Top             =   2460
  52.       Width           =   4395
  53.    End
  54.    Begin VB.TextBox CarbonCopyEmail 
  55.       Height          =   315
  56.       Left            =   4140
  57.       TabIndex        =   13
  58.       Top             =   3960
  59.       Width           =   3075
  60.    End
  61.    Begin VB.TextBox CarbonCopyName 
  62.       Height          =   315
  63.       Left            =   960
  64.       TabIndex        =   12
  65.       Top             =   3960
  66.       Width           =   3075
  67.    End
  68.    Begin VB.FileListBox InBox 
  69.       Height          =   870
  70.       Left            =   4200
  71.       Pattern         =   "*.mbx"
  72.       TabIndex        =   29
  73.       Top             =   840
  74.       Width           =   3015
  75.    End
  76.    Begin VB.TextBox EmailDate 
  77.       Height          =   315
  78.       Left            =   960
  79.       Locked          =   -1  'True
  80.       TabIndex        =   6
  81.       TabStop         =   0   'False
  82.       Top             =   2040
  83.       Width           =   4395
  84.    End
  85.    Begin VB.TextBox RecipientName 
  86.       Height          =   315
  87.       Left            =   960
  88.       TabIndex        =   10
  89.       Top             =   3540
  90.       Width           =   3075
  91.    End
  92.    Begin VB.CheckBox HostDelete 
  93.       Caption         =   "Delete email from host"
  94.       Height          =   375
  95.       Left            =   4200
  96.       TabIndex        =   4
  97.       Top             =   180
  98.       Value           =   1  'Checked
  99.       Width           =   1215
  100.    End
  101.    Begin VB.TextBox Status 
  102.       Height          =   735
  103.       Left            =   960
  104.       Locked          =   -1  'True
  105.       MultiLine       =   -1  'True
  106.       ScrollBars      =   2  'Vertical
  107.       TabIndex        =   16
  108.       TabStop         =   0   'False
  109.       Top             =   6060
  110.       Width           =   6255
  111.    End
  112.    Begin VB.TextBox SenderName 
  113.       Height          =   315
  114.       Left            =   960
  115.       TabIndex        =   8
  116.       Top             =   3120
  117.       Width           =   3075
  118.    End
  119.    Begin VB.TextBox UserPassword 
  120.       Height          =   315
  121.       IMEMode         =   3  'DISABLE
  122.       Left            =   960
  123.       PasswordChar    =   "*"
  124.       TabIndex        =   2
  125.       Top             =   960
  126.       Width           =   3075
  127.    End
  128.    Begin VB.TextBox UserAccount 
  129.       Height          =   315
  130.       Left            =   960
  131.       TabIndex        =   1
  132.       Top             =   540
  133.       Width           =   3075
  134.    End
  135.    Begin VB.TextBox HostName 
  136.       Height          =   315
  137.       Left            =   960
  138.       TabIndex        =   0
  139.       Top             =   120
  140.       Width           =   3075
  141.    End
  142.    Begin VB.CommandButton Send 
  143.       Caption         =   "Send Emails"
  144.       Height          =   495
  145.       Left            =   5520
  146.       TabIndex        =   17
  147.       Top             =   2040
  148.       Width           =   1695
  149.    End
  150.    Begin VB.TextBox EmailBody 
  151.       Height          =   915
  152.       Left            =   960
  153.       MultiLine       =   -1  'True
  154.       ScrollBars      =   2  'Vertical
  155.       TabIndex        =   15
  156.       Top             =   4800
  157.       Width           =   6255
  158.    End
  159.    Begin VB.TextBox EmailSubject 
  160.       Height          =   315
  161.       Left            =   960
  162.       TabIndex        =   14
  163.       Top             =   4380
  164.       Width           =   6255
  165.    End
  166.    Begin VB.TextBox RecipientEmail 
  167.       Height          =   315
  168.       Left            =   4140
  169.       TabIndex        =   11
  170.       Top             =   3540
  171.       Width           =   3075
  172.    End
  173.    Begin VB.TextBox SenderEmail 
  174.       Height          =   315
  175.       Left            =   4140
  176.       TabIndex        =   9
  177.       Top             =   3120
  178.       Width           =   3075
  179.    End
  180.    Begin VB.CommandButton Check 
  181.       Caption         =   "Check Emails"
  182.       Height          =   495
  183.       Left            =   5520
  184.       TabIndex        =   5
  185.       Top             =   120
  186.       Width           =   1695
  187.    End
  188.    Begin VB.Label Label15 
  189.       Caption         =   "Filter:"
  190.       Height          =   255
  191.       Left            =   120
  192.       TabIndex        =   33
  193.       Top             =   1440
  194.       Width           =   795
  195.    End
  196.    Begin VB.Label Label14 
  197.       Caption         =   "UIDL:"
  198.       Height          =   195
  199.       Left            =   120
  200.       TabIndex        =   32
  201.       Top             =   2520
  202.       Width           =   795
  203.    End
  204.    Begin VB.Label Label13 
  205.       Caption         =   "Cc:"
  206.       Height          =   255
  207.       Left            =   120
  208.       TabIndex        =   31
  209.       Top             =   4020
  210.       Width           =   795
  211.    End
  212.    Begin VB.Label Label12 
  213.       Caption         =   "InBox"
  214.       Height          =   195
  215.       Left            =   4200
  216.       TabIndex        =   30
  217.       Top             =   600
  218.       Width           =   495
  219.    End
  220.    Begin VB.Label Label11 
  221.       Caption         =   "Date:"
  222.       Height          =   255
  223.       Left            =   120
  224.       TabIndex        =   28
  225.       Top             =   2100
  226.       Width           =   795
  227.    End
  228.    Begin VB.Label Label10 
  229.       Caption         =   "Email address:"
  230.       Height          =   195
  231.       Left            =   4140
  232.       TabIndex        =   27
  233.       Top             =   2880
  234.       Width           =   1275
  235.    End
  236.    Begin VB.Line Line2 
  237.       X1              =   120
  238.       X2              =   7200
  239.       Y1              =   5880
  240.       Y2              =   5880
  241.    End
  242.    Begin VB.Label Label9 
  243.       Caption         =   "Status:"
  244.       Height          =   315
  245.       Left            =   120
  246.       TabIndex        =   26
  247.       Top             =   6120
  248.       Width           =   795
  249.    End
  250.    Begin VB.Label Label8 
  251.       Caption         =   "Full Name"
  252.       Height          =   255
  253.       Left            =   960
  254.       TabIndex        =   25
  255.       Top             =   2880
  256.       Width           =   1275
  257.    End
  258.    Begin VB.Line Line1 
  259.       X1              =   120
  260.       X2              =   7200
  261.       Y1              =   1860
  262.       Y2              =   1860
  263.    End
  264.    Begin VB.Label Label7 
  265.       Caption         =   "Password:"
  266.       Height          =   255
  267.       Left            =   120
  268.       TabIndex        =   24
  269.       Top             =   1020
  270.       Width           =   795
  271.    End
  272.    Begin VB.Label Label6 
  273.       Caption         =   "Account:"
  274.       Height          =   255
  275.       Left            =   120
  276.       TabIndex        =   23
  277.       Top             =   600
  278.       Width           =   795
  279.    End
  280.    Begin VB.Label Label5 
  281.       Caption         =   "Host:"
  282.       Height          =   255
  283.       Left            =   120
  284.       TabIndex        =   22
  285.       Top             =   180
  286.       Width           =   795
  287.    End
  288.    Begin VB.Label Label4 
  289.       Caption         =   "Message:"
  290.       Height          =   255
  291.       Left            =   120
  292.       TabIndex        =   21
  293.       Top             =   4860
  294.       Width           =   795
  295.    End
  296.    Begin VB.Label Label3 
  297.       Caption         =   "Subject:"
  298.       Height          =   255
  299.       Left            =   120
  300.       TabIndex        =   20
  301.       Top             =   4440
  302.       Width           =   795
  303.    End
  304.    Begin VB.Label Label2 
  305.       Caption         =   "To:"
  306.       Height          =   255
  307.       Left            =   120
  308.       TabIndex        =   19
  309.       Top             =   3600
  310.       Width           =   795
  311.    End
  312.    Begin VB.Label Label1 
  313.       Caption         =   "From:"
  314.       Height          =   255
  315.       Left            =   120
  316.       TabIndex        =   18
  317.       Top             =   3180
  318.       Width           =   795
  319.    End
  320. Attribute VB_Name = "TestMailLite"
  321. Attribute VB_GlobalNameSpace = False
  322. Attribute VB_Creatable = False
  323. Attribute VB_PredeclaredId = True
  324. Attribute VB_Exposed = False
  325. Option Explicit
  326. Option Compare Text
  327. Public CheckOk As Boolean
  328. Public Busy As Integer
  329. Public Msg As String
  330. Private Sub UserAccount_GotFocus()
  331.     UserAccount.SelStart = 0
  332.     UserAccount.SelLength = Len(UserAccount)
  333. End Sub
  334. Private Sub CarbonCopyEmail_GotFocus()
  335.     CarbonCopyEmail.SelStart = 0
  336.     CarbonCopyEmail.SelLength = Len(CarbonCopyEmail)
  337. End Sub
  338. Private Sub CarbonCopyName_GotFocus()
  339.     CarbonCopyName.SelStart = 0
  340.     CarbonCopyName.SelLength = Len(CarbonCopyName)
  341. End Sub
  342. Private Sub EmailFilter_GotFocus()
  343.     EmailFilter.SelStart = 0
  344.     EmailFilter.SelLength = Len(EmailFilter)
  345. End Sub
  346. Private Sub Form_Load()
  347.     MailLite1.EmailPath = App.Path
  348.     InBox.Path = MailLite1.EmailPath
  349. End Sub
  350. Private Sub HostName_GotFocus()
  351.     HostName.SelStart = 0
  352.     HostName.SelLength = Len(HostName)
  353. End Sub
  354. Private Sub InBox_DblClick()
  355.     If MailLite1.LoadEmail(InBox.filename) Then
  356.         UpdateTextBoxes
  357.     End If
  358. End Sub
  359. Private Sub UpdateTextBoxes()
  360.     EmailDate = MailLite1.EmailDate
  361.     EmailUIDL = MailLite1.EmailUIDL
  362.     SenderName = MailLite1.SenderName
  363.     SenderEmail = MailLite1.SenderEmail
  364.     RecipientName = MailLite1.RecipientName
  365.     RecipientEmail = MailLite1.RecipientEmail
  366.     CarbonCopyName = MailLite1.CarbonCopyName
  367.     CarbonCopyEmail = MailLite1.CarbonCopyEmail
  368.     EmailSubject = MailLite1.EmailSubject
  369.     EmailBody = MailLite1.EmailBody
  370. End Sub
  371. Private Sub MailLite1_Status(ByVal Code As Integer, ByVal Description As String)
  372.     Status.SelStart = Len(Status.Text)
  373.     Status.SelText = vbCrLf & CStr(Code) & " - " & Description
  374.     If Len(Status.Text) > 32000 Then
  375.         Status.Text = Mid(Status.Text, Len(Status.Text) - 32000)
  376.     End If
  377.     If Code = 117 Then
  378.         InBox.Refresh
  379.         UpdateTextBoxes
  380.     End If
  381. End Sub
  382. Private Sub Check_Click()
  383.     If Busy Then Exit Sub
  384.     Busy = True
  385.     MailLite1.HostPortPop3 = 110                        'default
  386.     MailLite1.HostNamePop3 = HostName
  387.     MailLite1.HostDelete = IIf(HostDelete, True, False)
  388.     MailLite1.UserAccount = UserAccount
  389.     MailLite1.UserPassword = UserPassword
  390.     MailLite1.EmailFilter = EmailFilter
  391.     'MailLite1.EmailFilter = "X-Priority: 1"
  392.     'MailLite1.EmailPath = App.Path
  393.     CheckOk = MailLite1.CheckEmail(True, True)
  394.     If Not CheckOk Then
  395.         If MailLite1.TotalEmails = MailLite1.TotalChecked Then
  396.             'it is a minor bug, all the mail was retrieved ok.
  397.             CheckOk = True
  398.         Else
  399.             If MailLite1.TotalChecked Then
  400.                 Msg = "We can read only " & CStr(MailLite1.TotalChecked) & " emails."
  401.             Else
  402.                 Msg = "We can not read any email."
  403.             End If
  404.             MsgBox "Some problem reading emails! - " & Msg & " - " & _
  405.                     "Error " & MailLite1.Error.Number & " - " & _
  406.                     MailLite1.Error.Description & ".", _
  407.                     vbExclamation, Me.Caption
  408.         End If
  409.     End If
  410.     If CheckOk Then
  411.         If MailLite1.TotalChecked > 1 Then
  412.             MsgBox "Was checked successfully " & CStr(MailLite1.TotalChecked) & " emails!", vbInformation, Me.Caption
  413.         ElseIf MailLite1.TotalChecked = 1 Then
  414.             MsgBox "One email was checked successfully!", vbInformation, Me.Caption
  415.         Else
  416.             MsgBox "There are not any email to retrieve from the mailbox!", vbInformation, Me.Caption
  417.         End If
  418.     End If
  419.     Busy = False
  420. End Sub
  421. Private Sub EmailBody_GotFocus()
  422.     EmailBody.SelStart = 0
  423.     EmailBody.SelLength = Len(EmailBody)
  424. End Sub
  425. Private Sub UserPassword_GotFocus()
  426.     UserPassword.SelStart = 0
  427.     UserPassword.SelLength = Len(UserPassword)
  428. End Sub
  429. Private Sub RecipientEmail_GotFocus()
  430.     RecipientEmail.SelStart = 0
  431.     RecipientEmail.SelLength = Len(RecipientEmail)
  432. End Sub
  433. Private Sub RecipientName_GotFocus()
  434.     RecipientName.SelStart = 0
  435.     RecipientName.SelLength = Len(RecipientName)
  436. End Sub
  437. Private Sub Send_Click()
  438.     If Busy Then Exit Sub
  439.     Busy = True
  440.     MailLite1.HostPortSmtp = 25                         'default
  441.     MailLite1.HostNameSmtp = HostName
  442.     MailLite1.SenderName = SenderName                   'optional
  443.     MailLite1.SenderEmail = SenderEmail
  444.     MailLite1.RecipientName = RecipientName             'optional
  445.     MailLite1.RecipientEmail = RecipientEmail
  446.     MailLite1.CarbonCopyName = CarbonCopyName           'optional
  447.     MailLite1.CarbonCopyEmail = CarbonCopyEmail         'optional
  448.     MailLite1.EmailSubject = EmailSubject
  449.     MailLite1.UserHeaders = "X-Priority: 1" & vbCrLf    'optional
  450.     MailLite1.EmailBody = EmailBody
  451.     If MailLite1.SendEmail() Then
  452.         MsgBox "The email was successfully sended!", vbInformation, Me.Caption
  453.     Else
  454.         MsgBox "Some problem sending emails! - " & _
  455.                 "Error " & MailLite1.Error.Number & " - " & _
  456.                 MailLite1.Error.Description & ".", _
  457.                 vbExclamation, Me.Caption
  458.     End If
  459.     Busy = False
  460. End Sub
  461. Private Sub SenderEmail_GotFocus()
  462.     SenderEmail.SelStart = 0
  463.     SenderEmail.SelLength = Len(SenderEmail)
  464. End Sub
  465. Private Sub SenderName_GotFocus()
  466.     SenderName.SelStart = 0
  467.     SenderName.SelLength = Len(SenderName)
  468. End Sub
  469. Private Sub EmailSubject_GotFocus()
  470.     EmailSubject.SelStart = 0
  471.     EmailSubject.SelLength = Len(EmailSubject)
  472. End Sub
  473.