C # Builder implementation of the monitor of POP3 mailbox

xiaoxiao2021-03-06  25

Borland's C # Builder is a C # language programming tool, C # Builder allows developers to develop by Java or CORBA tools, C # Builder also has the ability to read data from multiple databases, can mix and adapt to different development standards . This article describes how to write a mailbox monitoring program with Borland C # Builder, and the program is primarily network communication through WINSOCK. To implement this program, there must be a certain understanding of the POP3 protocol. The following is a rough introduction to the POP3 protocol. The reader can see the RFC 1225 to understand the agreement in more detail.

First, the POP3 agreement brief introduction

POP3 server programs typically serve in TCP port 110. When the customer wants to use the service, it creates a TCP connection with the server. Once the connection is established, the POP3 server sends a welcome message to the customer. The client then starts a command to the server, and the server gives the corresponding answer. The command of POP3 is composed of a keyword or keyword plus parameters. Each command is used as an end flag in the return line (0xD0XA). For all commands, POP3 servers provide an answer. The answer from the server is composed of some additional information. The two signs currently used are " OK" and "-err", indicating whether the customer's command is legal. All answered is also over the return line. The four POP3 commands related to topics discussed herein are User, Pass, Stat, and Quit.

User command

Format User Name

Where Name is the user ID of the user on the POP3 server. Customers should send this command after receiving the welcome message from the server or after the last user or pass failed.

Pass command

PASS STRING

Where string is the password of the user. The customer can send this command after sending the user command and receives a OK answer. If the username and password are correct, the server answers OK, otherwise -ERR.

STAT command

Format Stat

The stat command to view the mailbox. There are two numbers in the response of the stat command, indicating the number of messages, and the size of the message.

Quit command

Exit the login from the POP3 server.

Second, the monitoring program analysis of POP3 mailbox

The procedures we prepared should implement the following features:

1. Tray icon, program run, only display a tray icon, right-click the tray icon to pop up the menu.

2. Get the number of emails, based on the POP3 protocol, get the number of messages.

3. Read and write the registry, save the server, username, password, etc. set in the registry.

4. User prompt information, here we do a prompt window with MSN.

Third, the program is realized

Let's take our procedure below. First, open Borland C # Builder, create a new project, menu file-> C # Applicaion project name may wish to be set to "ChKPOP3", as shown below:

[Related map]

Design the main window, as shown below:

[Related map]

It mainly includes five text boxes, five labels, three buttons, a selection box and a Timer.

WinForm is set as follows:

TEXT: Acquisition Mail

StartPosition: CenterScreen

MaximizeBox: false

Three buttons:

Minimize buttons: Minimize the window, here is the hidden main window.

Take the mail button: implement the number of messages in the POP3 mailbox, and prompt with the information window.

Application Button: Save Set to the Registry

Timer1's function: Complete the number of mail in the POP3 mailbox within a certain time interval.

1. Implementation of the tray:

Select Components CONTEXTMENU from Tool Palette (add two menu items, settings, and exit), Notifyicon (Text is set to: email detection, icon icon Select a 16x16 small icon, and ContextMenu is set to the previously added contextMenu1, Visible is set to TRUE This is set up such a complete tray program. 2. The implementation of the user's prompt information:

Create a window WinForm1, set the form's FORMDERSTYLE property to none, then set the topMost property (always at the top) property to true, set the showintaskbar property (whether to display the form in the Windows taskbar) For False, add a text tag on the form, set the background of the form to the image you want and the appropriate size. Finally, put three Timer controls, where the Timer1 controls the animation that rolls out, Timer2 controls the form, the Timer3 controls the window, set their interval attribute to 10, as shown:

[Related map]

The WinForm1 code is as follows:

Using system;

Using system.drawing;

Using system.collections;

Using system.componentmodel;

Using system.windows.forms;

Using system.data;

Namespace POP3

{

///

/// summary description for Winform1.

///

Public Class Winform1: System.Windows.Forms.form

{

///

/// Required Designer Variable.

///

Private system.componentmodel.icontainer components;

Private system.windows.forms.timer Timer1;

Private system.windows.forms.timer Timer2;

Private system.windows.forms.timer Timer3;

Private system.windows.forms.linklabel linkLabel1;

Public String Str_num;

Public winform1 ()

{

//

// Required for Windows Form Designer Support

//

InitializationComponent ();

//

// Todo: Add Any Constructionor Code After InitializationComponent Call

//

}

///

/// Clean Up Any Resources Being Used.

///

Protected Override Void Dispose (Bool Disposing)

{

IF (Disposing)

{

IF (Components! = NULL)

{

Components.dispose ();

}

}

Base.dispose (Disposing);

}

#Region Windows Form Designer Generated Code

///

/// Required Method for Designer Support - Do Not Modify /// The Contents of this Method with the code editor.

///

Private vidinitiRizeComponent ()

{

This.Components = new system.componentmodel.container ();

System.Resources.ResourceManager Resources = New System.Resources.ResourceManager (TypeOf (Winform1));

this.timer1 = new system.windows.forms.timer (this.components);

this.timer2 = new system.windows.forms.timer (this.components);

This.timer3 = new system.windows.Forms.timer (this.components);

This.LinkLabel1 = new system.windows.forms.linklabel ();

THIS.SUSPENDLAYOUT ();

//

// Timer1

//

THIS.TIMER1.ITERVAL = 10;

This.Timer1.Tick = new system.eventhandler (this.timer1_thing);

//

// Timer2

//

THIS.TIMER2.ITERVAL = 10;

This.Timer2.Tick = new system.eventhandler (this.timer2_tick);

//

// Timer3

//

THIS.TIMER3.ITERVAL = 10;

This.Timer3.Tick = new system.eventhandler (this.timer3_tick);

//

// linklabel1

//

THISLINKLABEL1.AUTOSIZE = True;

THIS.LINKLABEL1.BACKCOLOR = system.drawing.color.whitesmoke;

This.LinkLabel1.Location = new system.drawing.point (56, 56);

This.LinkLabel1.Name = "LinkLabel1";

This.LinkLabel1.size = new system.drawing.size (79, 17);

this.linklabel1.tabindex = 0;

THISLINKLABEL1.TABSTOP = TRUE;

This.LinkLabel1.Text = "You have new emails!";

//

// Winform1

//

THIS.AUTOSCALEBASESIZE = New System.drawing.size (6, 14);

THIS.BACKCOLOR = system.drawing.systemcolors.Info;

THIS.BACKGROUNDIMAGE = ((System.drawing.Image) ("$ this.BackgroundImage))))))))

THIS.CLIENTSIZE = New System.drawing.size (194, 122);

This.Controls.add (this.LinkLabel1); this.formborderstyle = system.windows.forms.formorderstyle.none;

THIS.NAME = "WinForm1";

THIS.SHOWINTASKBAR = FALSE;

This.Text = "Information Tips";

THIS.TOPMOST = True;

This.Load = New System.EventHandler (this.winform1_load);

THIS.Activated = new system.EventHandler (this.winform1_actiVated);

This.ResumeLayout (false);

}

#ndregion

Private void Winform1_Load (Object Sender, System.EventArgs E)

{

Screen [] screens = screen.allscreens;

Screen Screen = Screens [0];

THIS.LOCATION = New Point (Screen.workingArea.width - 200, Screen.workingArea.Height - 30);

this.timer2.interval = 5000;

}

Private void scrollup ()

{

IF (Height <122)

{

THISHEIGHT = 3;

THIS.LOCATION = New Point (this.location.x, this.location.y - 3);

}

Else

{

this.timer1.enabled = false;

this.timer2.enabled = true;

}

}

Private void scrolldown ()

{

IF (HEIGHT> 3)

{

THIS.HEIGHT - = 3;

This.location = new point (this.location.x, this.location.y 3);

}

Else

{

THIS.TIMER3.ENABLED = FALSE;

THIS.CLOSE ();

}

}

Private void Timer1_Tick (Object Sender, System.EventArgs E)

{

Scrollup ();

}

Private void Timer2_Tick (Object Sender, System.EventArgs E)

{

Timer2.enabled = false;

Timer3.enabled = true;

}

Private void Timer3_Tick (Object Sender, System.EventArgs E)

{

ScrollDown ();

}

Public void scrollshow ()

{

THIS.WIDTH = 194;

THIS.HEIGHT = 0;

THIS.SHOW ();

THIS.TIMER1.ENABLED = TRUE;

}

Private Void Winform1_Activated (Object Sender, System.Eventargs E)

{

Linklabel1.text = "You have" str_num "new mail!"

}

}

}

Specific implementation, you can refer to an article on the Internet: "Writing the MSN Messager scrolling window with VC #", it has not been clear, you can pass this network http://yousoft.hi.com.cn/ Article_view.asp? id = 6595 browse.

3. Get the implementation of the number of emails, the code is shown in:

String STR_SERVER;

IF ((tb_server.text! = ") && (tb_user.text! =" ") && (tb_pwd.text! ="))

{

TcpClient TCPC = New TcpClient (TB_SERVER.TEXT, 110);

UTE [] outbytes;

String input;

NetWorkstream ns = NULL;

Try {

NS = tcpc.getStream ();

StreamReader SR = New StreamReader (NS);

TB_STATUS.TEXT = Sr.Readline ();

Input = "user" TB_USER.TEXT "/ R / N";

Outbytes = system.text.Encoding.ascii.getbytes (Input.tochararray ());

NS.Write (Outbytes, 0, Outbytes.Length)

Tb_status.text = tb_status.text "/ r / n" sr.readline ();

Input = "pass" tb_pwd.text "/ r / n";

Outbytes = system.text.Encoding.ascii.getbytes (Input.tochararray ());

NS.Write (Outbytes, 0, Outbytes.Length)

Tb_status.text = tb_status.text "/ r / n" sr.readline ();

INPUT = "stat" "/ r / n";

Outbytes = system.text.Encoding.ascii.getbytes (Input.tochararray ());

NS.Write (Outbytes, 0, Outbytes.Length)

Str_server = sr.readline ();

STR_NUM = ""

IF (str_server.startswith (" ok")) {

STR_NUM = STR_SERVER.SPLIT ('') [1];

} else str_num = ""

Tb_status.text = TB_STATUS.TEXT "/ R / N" "A:" STR_SERVER;

INPUT = "quit" "/ r / n";

Outbytes = system.text.Encoding.ascii.getbytes (Input.tochararray ());

NS.Write (Outbytes, 0, Outbytes.Length)

Tb_status.text = tb_status.text "/ r / n" "B:" sr.readline ();}

Catch (InvalidOperationException IoE) {

TB_STATUS.TEXT = "Could Not Connect To Mail Server";

}

IF (str_num! = "") {

Winform1 Form = New Winform1 ();

Form.STR_NUM = STR_NUM;

Form.ScrollShow ();

}

The program creates a TCP connection with the mail server, then send some commands of POP3, take the information transmitted by the server to get the number of messages.

There are two numbers in the response of the stat command, indicating the number of messages, and the size of the message. The general format is such a " OK quantity size"

So, simply extract OK according to the information returned by the server, and then separate the space separately. See the code.

4. Reading and writing of the registry:

We know, to implement the program after boot, you can implement it by writing registry hkey_current_user / suftware / microsoft / windows / currentversion / run implementation

In addition, in order to facilitate the user, we store mail servers, users, passwords and other information into the registry, and don't have to lose once each time.

The saving information code is as follows:

RegistryKey RK;

Registry.currentuser.createSubKey ("Software // YOSOFT");

RK = registry.currentuser.opensubKey ("Software // YOUSOFT", TRUE

RK.SetValue ("Server", TB_SERVER.TEXT);

RK.SetValue ("User", TB_USER.TEXT);

RK.SetValue ("PWD", TB_PWD.TEXT);

RK.SetValue ("Interval", TB_Mins.Text);

IF (CB_AUTORUN.CHECKED) {

RK = registry.currentuser.opensubKey ("Software // Microsoft // Windows // CurrentVersion // Run", true);

RK.SetValue ("Chkmail", Application.executablePath;

Else

{

RK = registry.currentuser.opensubKey ("Software // Microsoft // Windows // CurrentVersion // Run", true);

RK.DeleteValue ("chkmail");

}

RK.Close ();

Read information when starting the program:

Private Void Winform_Load (Object Sender, System.EventArgs E)

{

RegistryKey RK;

RK = registry.currentuser.opensubKey ("Software // YOUSOFT", FALSE);

Object SRV = RK.GetValue ("Server");

IF (SRV! = null) TB_SERVER.TEXT = SRV.TOSTRING ();

Object usr = rk.getValue ("User"); if (usr! = null) TB_USER.TEXT = usr.tostring ();

Object PWD = RK.GetValue ("PWD");

IF (PWD! = NULL) TB_PWD.TEXT = PWD.TOSTRING ();

Object mins = rk.getValue ("interval");

IF (mins! = null) TB_Mins.Text = mins.tostring ();

RK.Close ();

}

The full code of WinForm is as follows:

Using system;

Using system.drawing;

Using system.collections;

Using system.componentmodel;

Using system.windows.forms;

Using system.data;

Using system.net.sockets;

Using system.io;

Using system.net;

USING Microsoft.win32;

Namespace POP3

{

///

/// summary description for WinForm.

///

Public Class Winform: System.Windows.Forms.form

{

///

/// Required Designer Variable.

///

Private system.componentmodel.icontainer components;

Private system.windows.Forms.Button button1;

Private system.windows.Forms.Label label1;

Private system.windows.Forms.Label label2;

Private system.windows.Forms.Label label3;

Private system.windows.forms.textbox tb_server;

Private system.windows.Forms.TextBox TB_USER;

Private system.windows.Forms.TextBox TB_PWD;

Private system.windows.Forms.TextBox TB_STATUS;

Private system.windows.Forms.notifyicon Notifyicon1;

Private system.windows.forms.contextMenu contextMenu1;

Private system.windows.Forms.MenuItem Menuitem1;

Private system.windows.Forms.MenuItem Menuitem2;

Private system.windows.Forms.MenuItem MenuItem3;

PRIVATE BOOL F_OPEN = True;

Private string str_num = ""

Private system.windows.Forms.Button Button2;

Private system.windows.forms.timer Timer1;

Private system.windows.forms.textbox tb_mins;

Private system.windows.Forms.Label label4;

Private system.windows.forms.label label5; private system.windows.Forms.Button Button3;

Private system.windows.Forms.checkbox CB_AUTORUN;

Public winform ()

{

//

// Required for Windows Form Designer Support

//

InitializationComponent ();

//

// Todo: Add Any Constructionor Code After InitializationComponent Call

//

}

///

/// Clean Up Any Resources Being Used.

///

Protected Override Void Dispose (Bool Disposing)

{

IF (Disposing)

{

IF (Components! = NULL)

{

Components.dispose ();

}

}

Base.dispose (Disposing);

}

#Region Windows Form Designer Generated Code

///

/// Required Method for Designer Support - Do Not Modify

/// The contents of this method with the code editor.

///

Private vidinitiRizeComponent ()

{

This.Components = new system.componentmodel.container ();

System.Resources.ResourceManager Resources = New System.Resources.ResourceManager (TypeOf (WinForm));

This.button1 = new system.windows.Forms.Button ();

THIS.LABEL1 = New System.windows.Forms.label ();

THIS.LABEL2 = New System.windows.Forms.label ();

This.label3 = new system.windows.Forms.label ();

This.tb_server = new system.windows.Forms.TextBox ();

THIS.TB_USER = New System.Windows.Forms.TextBox ();

This.tb_pwd = new system.windows.Forms.TextBox ();

THIS.TB_STATUS = New System.windows.Forms.TextBox ();

This.notifyicon1 = new system.windows.Forms.notifyicon (this.components);

This.ContextMenu1 = new system.windows.Forms.ContextMenu ();

THIS.MENUITEM1 = New System.windows.Forms.Menuitem ();

THIS.MENUITEM2 = New System.windows.Forms.MenuItem ();

THIS.MENUITEM3 = New System.windows.Forms.MenuItem ();

This.button2 = new system.windows.Forms.Button (); this.timer1 = new system.windows.forms.timer (this.components);

This.tb_mins = new system.windows.Forms.TextBox ();

THIS.LABEL4 = New System.windows.Forms.label ();

THIS.LABEL5 = New System.windows.Forms.label ();

This.Button3 = new system.windows.Forms.Button ();

THIS.CB_AUTORUN = New System.windows.Forms.Checkbox ();

THIS.SUSPENDLAYOUT ();

//

// Button1

//

This.Button1.Location = new system.drawing.point (152, 176);

This.button1.name = "button1";

this.button1.tabindex = 0;

This.button1.text = "Take Mail";

This.Button1.click = new system.eventhandler (this.button1_click);

//

// label1

//

THIS.Label1.Location = new system.drawing.point (24, 32);

THIS.LABEL1.NAME = "label1";

THIS.Label1.size = new system.drawing.size (80, 23);

THIS.Label1.tabindex = 1;

This.Label1.Text = "Mail server:";

//

// label2

//

This.Label2.Location = new system.drawing.point (48, 64);

THIS.LABEL2.NAME = "label2";

THIS.Label2.size = new system.drawing.size (56, 23);

THIS.Label2.tabindex = 2;

This.Label2.Text = "User Name:";

//

// label3

//

This.Label3.Location = new system.drawing.point (58, 96);

THIS.LABEL3.NAME = "label3";

This.label3.size = new system.drawing.size (48, 23);

THIS.Label3.tabindex = 3;

This.Label3.Text = "Password:";

//

// TB_SERVER

//

this.tb_server.location = new system.drawing.point (112, 24);

THIS.TB_SERVER.NAME = "TB_SERVER";

this.tb_server.size = new system.drawing.size (176, 21);

THIS.TB_SERVER.TABINDEX = 4;

THIS.TB_SERVER.TEXT = ""

this.tb_server.textchanged = new system.eventhandler (this.tb_pwd_textchanged); //

// TB_USER

//

This.tb_user.location = new system.drawing.point (112, 60);

THIS.TB_USER.NAME = "TB_USER";

this.tb_user.size = new system.drawing.size (176, 21);

THIS.TB_USER.TABINDEX = 5;

THIS.TB_USER.TEXT = ""

This.tb_user.textchanged = new system.eventhandler (this.tb_pwd_textchange;

//

// tb_pwd

//

this.tb_pwd.location = new system.drawing.point (112, 91);

THIS.TB_PWD.NAME = "TB_PWD";

THIS.TB_PWD.PASSWORDCHAR = '*';

this.tb_pwd.size = new system.drawing.size (176, 21);

THIS.TB_PWD.TABINDEX = 6;

THIS.TB_PWD.TEXT = ""

THIS.TB_PWD.TEXTCHANGED = New System.EventHandler (this.tb_pwd_textchange);

//

// TB_STATUS

//

this.tb_status.location = new system.drawing.point (16, 208);

THIS.TB_STATUS.MULTILINE = True;

THIS.TB_STATUS.NAME = "TB_STATUS";

this.tb_status.size = new system.drawing.size (328, 80);

THIS.TB_STATUS.TABINDEX = 7;

THIS.TB_STATUS.TEXT = ""

//

// Notifyicon1

//

THIS.NOTIFYICON1.CONTEXTMENU = this.ContextMenu1;

.Notifyicon1.icon = ((System.drawing.icon) ("Notifyicon1.ICON")))

THIS.NOTIFYICON1.TEXT = "Mail Detection";

THISIBLE = TRUE;

//

// contextMenu1

//

This.ContextMenu1.Menuitems.Addrange (new system.windows.forms.Menuitem [] {

This.Menuitem1,

THIS.MENUITEM2,

THIS.MENUITEM3});

//

// Menuitem1

//

THIS.MENUITEM1.INDEX = 0;

THIS.MENUITEM1.TEXT = "Setting & S";

THIS.MENUITEM1.Click = new system.eventhandler (this.Menuitem1_click);

//

// Menuitem2

//

This.Menuitem2.index = 1; this.Menuitem2.text = "-";

//

// Menuitem3

//

THIS.MENUITEM3.INDEX = 2;

THIS.MENUITEM3.TEXT = "Exit & Q";

This.Menuitem3.click = new system.eventhandler (this.MenuItem3_click);

//

// Button2

//

This.Button2.Location = new system.drawing.point (48, 176);

This.Button2.name = "button2";

this.button2.tabindex = 8;

This.Button2.Text = "Minimize";

This.button2.click = new system.eventhandler (this.button2_click);

//

// Timer1

//

this.timer1.interval = 5000;

This.Timer1.Tick = new system.eventhandler (this.timer1_thing);

//

// tb_mins

//

this.tb_mins.location = new system.drawing.point (112, 124);

THIS.TB_MINS.NAME = "TB_Mins";

THIS.TB_MINS.SIZE = New System.drawing.size (144, 21);

THIS.TB_MINS.TABINDEX = 10;

THIS.TB_MINS.TEXT = "20000";

This.tb_mins.textchanged = new system.eventhandler (this.tb_pwd_textchange);

//

// label4

//

THIS.LABEL4.LOCATION = New System.drawing.Point (32, 128);

THIS.LABEL4.NAME = "label4";

THIS.Label4.size = new system.drawing.size (72, 23);

THIS.Label4.tabindex = 9;

THIS.LABEL4.TEXT = "Time Interval:";

//

// Label5

//

This.label5.Location = new system.drawing.point (264, 129);

THIS.LABEL5.NAME = "label5";

THIS.Label5.size = new system.drawing.size (40, 16);

THIS.LABEL5.TABINDEX = 11;

this.label5.text = "millisecond";

//

// Button3

//

This.Button3.Location = new system.drawing.point (264, 176);

This.button3.name = "button3";

This.button3.tabindex = 12;

This.Button3.Text = "Application";

This.Button3.click = new system.eventhandler (this.button3_click); //

// CB_AUTORUN

//

THIS.CB_AUTORUN.LOCATION = New System.drawing.Point (112, 152);

THIS.CB_AUTORUN.NAME = "CB_AUTORUN";

this.cb_autorun.size = new system.drawing.size (160, 24);

THIS.CB_AUTORUN.TABINDEX = 13;

THIS.CB_AUTORUN.TEXT = "Automated execution when starting";

//

// WinForm

//

THIS.AUTOSCALEBASESIZE = New System.drawing.size (6, 14);

This.ClientSize = new system.drawing.size (368, 301);

This.Controls.add (this.cb_autorun);

This.Controls.add (this.button3);

This.Controls.add (this.label5);

This.Controls.add (this.tb_mins);

This.Controls.add (this.label4);

This.Controls.add (this.button2);

This.Controls.add (this.tb_status);

This.Controls.add (this.tb_pwd);

This.Controls.add (this.tb_user);

This.Controls.add (this.tb_server);

THIS.CONTROLS.ADD (this.label3);

THIS.CONTROLS.ADD (this.label2);

This.Controls.add (this.label1);

This.Controls.add (this.button1);

This.icon = ((System.drawing.icon) ("$ this.icon")))

THIS.MAXIMIZEBOX = FALSE;

THIS.NAME = "Winform";

This.startPosition = system.windows.forms.formstartPosition.CenterScreen

this.Text = "Collect Mail";

This.Load = New System.EventHandler (this.winform_load);

THIS.Activated = new system.eventhandler (this.winform_activated);

This.ResumeLayout (false);

}

#ndregion

///

/// The main entry point for the application.

///

[Stathread]

Static void main ()

{

Application.run (New WinForm ());

}

Private void Button1_Click (Object Sender, System.Eventargs E)

{

String STR_SERVER;

IF ((tb_server.text! = ") && (tb_user.text! =") && (TB_PWD.TEXT! = ")) {

TcpClient TCPC = New TcpClient (TB_SERVER.TEXT, 110);

UTE [] outbytes;

String input;

NetWorkstream ns = NULL;

Try {

NS = tcpc.getStream ();

StreamReader SR = New StreamReader (NS);

TB_STATUS.TEXT = Sr.Readline ();

Input = "user" TB_USER.TEXT "/ R / N";

Outbytes = system.text.Encoding.ascii.getbytes (Input.tochararray ());

NS.Write (Outbytes, 0, Outbytes.Length)

Tb_status.text = tb_status.text "/ r / n" sr.readline ();

Input = "pass" tb_pwd.text "/ r / n";

Outbytes = system.text.Encoding.ascii.getbytes (Input.tochararray ());

NS.Write (Outbytes, 0, Outbytes.Length)

Tb_status.text = tb_status.text "/ r / n" sr.readline ();

INPUT = "stat" "/ r / n";

Outbytes = system.text.Encoding.ascii.getbytes (Input.tochararray ());

NS.Write (Outbytes, 0, Outbytes.Length)

Str_server = sr.readline ();

STR_NUM = ""

IF (str_server.startswith (" ok")) {

STR_NUM = STR_SERVER.SPLIT ('') [1];

} else str_num = ""

Tb_status.text = tb_status.text "/ r / n" STR_SERVER;

INPUT = "quit" "/ r / n";

Outbytes = system.text.Encoding.ascii.getbytes (Input.tochararray ());

NS.Write (Outbytes, 0, Outbytes.Length)

Tb_status.text = tb_status.text "/ r / n" sr.readline ();

}

Catch (InvalidOperationException IoE) {

TB_STATUS.TEXT = "Could Not Connect To Mail Server";

}

IF (str_num! = "") {

Winform1 Form = New Winform1 ();

Form.STR_NUM = STR_NUM;

Form.ScrollShow ();

}

}

}

Private void Winform_Activated (Object Sender, System.Eventargs E)

{

IF (f_open) {

THIS.HIDE ();

f_open = false;

}

}

Private Void Menuitem3_Click (Object Sender, System.EventArgs E)

{

THIS.CLOSE ();

}

Private void Menuitem1_Click (Object Sender, System.Eventargs E)

{

THIS.SHOW ();

THIS.FOCUS ();

}

Private void button2_click (Object Sender, System.Eventargs E)

{

THIS.HIDE ();

}

Private void Timer1_Tick (Object Sender, System.EventArgs E)

{

Button1_click (sender, e);

}

Private void TB_PWD_TextChanged (Object Sender, System.EventArgs E)

{

Timer1.enabled = false;

IF ((tb_server.text! = ") && (tb_user.text! =" ") && (tb_pwd.text! ="))

{

Timer1.interval = system.convert.toint32 (tb_mins.text);

Timer1.enabled = True;

Else

{

Timer1.enabled = false;

}

}

Private void button3_click (Object Sender, System.Eventargs E)

{

RegistryKey RK;

Registry.currentuser.createSubKey ("Software // YOSOFT");

RK = registry.currentuser.opensubKey ("Software // YOUSOFT", TRUE

RK.SetValue ("Server", TB_SERVER.TEXT);

RK.SetValue ("User", TB_USER.TEXT);

RK.SetValue ("PWD", TB_PWD.TEXT);

RK.SetValue ("Interval", TB_Mins.Text);

IF (CB_AUTORUN.CHECKED) {

RK = registry.currentuser.opensubKey ("Software // Microsoft // Windows // CurrentVersion // Run", true);

RK.SetValue ("Chkmail", Application.executablePath;

Else

{

RK = registry.currentuser.opensubKey ("Software // Microsoft // Windows // CurrentVersion // Run", true);

RK.DeleteValue ("chkmail");

}

RK.Close ();

}

Private Void Winform_Load (Object Sender, System.EventArgs E)

{

RegistryKey RK;

RK = registry.currentuser.opensubKey ("Software // YOUSOFT", FALSE); Object SRV = RK.GETVALUE ("Server");

IF (SRV! = null) TB_SERVER.TEXT = SRV.TOSTRING ();

Object usr = rk.getValue ("user");

IF (usr! = null) TB_USER.TEXT = usr.tostring ();

Object PWD = RK.GetValue ("PWD");

IF (PWD! = NULL) TB_PWD.TEXT = PWD.TOSTRING ();

Object mins = rk.getValue ("interval");

IF (mins! = null) TB_Mins.Text = mins.tostring ();

RK.Close ();

}

}

}

Related map

[Related map]

转载请注明原文地址:https://www.9cbs.com/read-40937.html

New Post(0)