home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 6_2008-2009.ISO / data / zips / SSL_eMail_222364592012.psc / frmSettings.frm < prev    next >
Text File  |  2009-03-28  |  7KB  |  253 lines

  1. VERSION 5.00
  2. Begin VB.Form frmSettings 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "Email Settings"
  5.    ClientHeight    =   3825
  6.    ClientLeft      =   45
  7.    ClientTop       =   285
  8.    ClientWidth     =   4680
  9.    Icon            =   "frmSettings.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   3825
  14.    ScaleWidth      =   4680
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   2  'CenterScreen
  17.    Begin VB.TextBox txtName 
  18.       Height          =   285
  19.       Left            =   1200
  20.       TabIndex        =   13
  21.       Top             =   1320
  22.       Width           =   2415
  23.    End
  24.    Begin VB.TextBox txtFrom 
  25.       Height          =   285
  26.       Left            =   1200
  27.       TabIndex        =   11
  28.       Top             =   960
  29.       Width           =   2415
  30.    End
  31.    Begin VB.CommandButton cmdOK 
  32.       Caption         =   "&OK"
  33.       Default         =   -1  'True
  34.       Height          =   375
  35.       Left            =   3240
  36.       TabIndex        =   6
  37.       Top             =   3240
  38.       Width           =   1215
  39.    End
  40.    Begin VB.CommandButton cmdCancel 
  41.       Caption         =   "&Cancel"
  42.       Height          =   375
  43.       Left            =   1920
  44.       TabIndex        =   5
  45.       Top             =   3240
  46.       Width           =   1215
  47.    End
  48.    Begin VB.CheckBox chkSSL 
  49.       Caption         =   "Needs SSL"
  50.       Height          =   375
  51.       Left            =   240
  52.       TabIndex        =   2
  53.       Top             =   1680
  54.       Value           =   1  'Checked
  55.       Width           =   1815
  56.    End
  57.    Begin VB.TextBox txtPass 
  58.       Height          =   285
  59.       IMEMode         =   3  'DISABLE
  60.       Left            =   1200
  61.       PasswordChar    =   "*"
  62.       TabIndex        =   4
  63.       Top             =   2760
  64.       Width           =   2055
  65.    End
  66.    Begin VB.TextBox txtPort 
  67.       Height          =   285
  68.       Left            =   1200
  69.       TabIndex        =   1
  70.       Top             =   600
  71.       Width           =   975
  72.    End
  73.    Begin VB.TextBox txtUserID 
  74.       Height          =   285
  75.       Left            =   1200
  76.       TabIndex        =   3
  77.       Top             =   2400
  78.       Width           =   2055
  79.    End
  80.    Begin VB.TextBox txtServer 
  81.       Height          =   285
  82.       Left            =   1200
  83.       TabIndex        =   0
  84.       Top             =   240
  85.       Width           =   2055
  86.    End
  87.    Begin VB.Line Line1 
  88.       BorderColor     =   &H80000010&
  89.       Index           =   1
  90.       X1              =   0
  91.       X2              =   4770
  92.       Y1              =   2265
  93.       Y2              =   2265
  94.    End
  95.    Begin VB.Label Label6 
  96.       AutoSize        =   -1  'True
  97.       Caption         =   "Name:"
  98.       Height          =   195
  99.       Left            =   660
  100.       TabIndex        =   14
  101.       Top             =   1320
  102.       Width           =   465
  103.    End
  104.    Begin VB.Line Line1 
  105.       BorderColor     =   &H80000005&
  106.       BorderWidth     =   2
  107.       Index           =   0
  108.       X1              =   0
  109.       X2              =   4680
  110.       Y1              =   2280
  111.       Y2              =   2280
  112.    End
  113.    Begin VB.Label Label5 
  114.       AutoSize        =   -1  'True
  115.       Caption         =   "From Address:"
  116.       Height          =   195
  117.       Left            =   120
  118.       TabIndex        =   12
  119.       Top             =   960
  120.       Width           =   1005
  121.    End
  122.    Begin VB.Label Label4 
  123.       AutoSize        =   -1  'True
  124.       Caption         =   "Password:"
  125.       Height          =   195
  126.       Left            =   435
  127.       TabIndex        =   10
  128.       Top             =   2760
  129.       Width           =   735
  130.    End
  131.    Begin VB.Label Label3 
  132.       AutoSize        =   -1  'True
  133.       Caption         =   "User ID:"
  134.       Height          =   195
  135.       Left            =   585
  136.       TabIndex        =   9
  137.       Top             =   2400
  138.       Width           =   585
  139.    End
  140.    Begin VB.Label Label2 
  141.       AutoSize        =   -1  'True
  142.       Caption         =   "Port:"
  143.       Height          =   195
  144.       Left            =   840
  145.       TabIndex        =   8
  146.       Top             =   600
  147.       Width           =   330
  148.    End
  149.    Begin VB.Label Label1 
  150.       AutoSize        =   -1  'True
  151.       Caption         =   "Server Name:"
  152.       Height          =   195
  153.       Left            =   195
  154.       TabIndex        =   7
  155.       Top             =   240
  156.       Width           =   975
  157.    End
  158. End
  159. Attribute VB_Name = "frmSettings"
  160. Attribute VB_GlobalNameSpace = False
  161. Attribute VB_Creatable = False
  162. Attribute VB_PredeclaredId = True
  163. Attribute VB_Exposed = False
  164. Option Explicit
  165.  
  166. Private Function EncryptPass(strPass As String) As String
  167.     Dim pstrtmp As String
  168.     Dim pintPos As Integer
  169.     Dim pintC As Integer
  170.     
  171.     For pintC = 1 To Len(strPass)
  172.       pstrtmp = Right(strPass, 1)
  173.       EncryptPass = EncryptPass & Asc(pstrtmp) + 3 & "-"
  174.       strPass = Left(strPass, Len(strPass) - 1)
  175.     Next
  176.     
  177. End Function
  178.  
  179. Public Function DecryptPass(strPass As String) As String
  180.     Dim pstrtmp As String
  181.     Dim pintPos As Integer
  182.     Dim pintC As Integer
  183.     
  184.     pintPos = InStr(strPass, "-")
  185.     Do Until pintPos = 0
  186.       pstrtmp = Left(strPass, pintPos)
  187.       DecryptPass = DecryptPass & Chr(Val(pstrtmp) - 3)
  188.       strPass = Replace(strPass, pstrtmp, "", 1, 1)
  189.       pintPos = InStr(strPass, "-")
  190.     Loop
  191.     
  192.     DecryptPass = StrReverse(DecryptPass)
  193.     
  194. End Function
  195.  
  196. Private Sub chkSSL_Click()
  197.     chkSSL.Value = vbChecked
  198. End Sub
  199.  
  200. Private Sub cmdCancel_Click()
  201.     Unload Me
  202. End Sub
  203.  
  204. Private Sub cmdOK_Click()
  205.     Dim pstrPass As String
  206.     
  207.     pstrPass = EncryptPass(Trim(txtPass.Text))
  208.     
  209.     SaveSetting App.Title, "SrvConfig", "ServerName", Trim(txtServer.Text)
  210.     SaveSetting App.Title, "SrvConfig", "UserID", Trim(txtUserID.Text)
  211.     SaveSetting App.Title, "SrvConfig", "UserPass", pstrPass
  212.     SaveSetting App.Title, "SrvConfig", "Port", Trim(txtPort.Text)
  213.     SaveSetting App.Title, "SrvConfig", "UserName", Trim(txtName.Text)
  214.     SaveSetting App.Title, "SrvConfig", "SSL", IIf(chkSSL.Value = vbChecked, True, False)
  215.     SaveSetting App.Title, "SrvConfig", "FromAddress", Trim(txtFrom.Text)
  216.     
  217.     Unload Me
  218.     
  219. End Sub
  220.  
  221. Private Sub Form_Load()
  222.     
  223.     Dim pstrSSL As String
  224.     
  225.     On Error Resume Next
  226.     
  227.     txtServer.Text = GetSetting(App.Title, "SrvConfig", "ServerName", "smtp.live.com")
  228.     txtUserID.Text = GetSetting(App.Title, "SrvConfig", "UserID", "xxxxxx@live.it")
  229.     txtPass.Text = GetSetting(App.Title, "SrvConfig", "UserPass", "")
  230.     txtPass.Text = DecryptPass(txtPass.Text)
  231.     txtPort.Text = GetSetting(App.Title, "SrvConfig", "Port", "587")
  232.     pstrSSL = GetSetting(App.Title, "SrvConfig", "SSL", "True")
  233.     txtName.Text = GetSetting(App.Title, "SrvConfig", "UserName", "GioRock")
  234.     txtFrom.Text = GetSetting(App.Title, "SrvConfig", "FromAddress", "xxxxxx@live.it")
  235.     
  236.     If pstrSSL = "True" Then
  237.         chkSSL.Value = vbChecked
  238.     Else
  239.         chkSSL.Value = vbUnchecked
  240.     End If
  241.     
  242. End Sub
  243.  
  244. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  245.     Screen.MousePointer = vbNormal
  246. End Sub
  247.  
  248. Private Sub Form_Unload(Cancel As Integer)
  249.     Set frmSettings = Nothing
  250. End Sub
  251.  
  252.  
  253.