Форум программистов, компьютерный форум, киберфорум
C# .NET
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
9 / 9 / 1
Регистрация: 06.09.2009
Сообщений: 54
1

Помогите с клиентом разобраться...

18.09.2009, 13:53. Показов 1194. Ответов 0
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
есть E-mail cheker написаный мной. тока вот проблема отображение почты идёт в хтмл формате т.е тупо все флаги форматирования есть как его можно отсеять или переконвертить в нормальный текст(удобночитаемый). ЗАРАНЕЕ БЛАГОДАРЕН!!!!
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Net;
using System.Net.Sockets;
using System.IO;
 
namespace POPapp
{
    /// <summary>
    /// Summary description for Form1.
    /// </summary>
    public class POPForm : System.Windows.Forms.Form
    {
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.TextBox POPServ;
        private System.Windows.Forms.TextBox User;
        private System.Windows.Forms.TextBox Passw;
        private System.Windows.Forms.RichTextBox Message;
        private System.Windows.Forms.Button ConnectBtn;
        private System.Windows.Forms.Button DisconnectBtn;
        private System.Windows.Forms.ListBox Status;
        private System.Windows.Forms.Button RetrieveBtn;
        private System.Windows.Forms.TextBox Number;
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components = null;
 
        public POPForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
 
            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
 
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if (components != null) 
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }
 
        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.Number = new System.Windows.Forms.TextBox();
            this.Status = new System.Windows.Forms.ListBox();
            this.label4 = new System.Windows.Forms.Label();
            this.Message = new System.Windows.Forms.RichTextBox();
            this.label6 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.ConnectBtn = new System.Windows.Forms.Button();
            this.POPServ = new System.Windows.Forms.TextBox();
            this.User = new System.Windows.Forms.TextBox();
            this.DisconnectBtn = new System.Windows.Forms.Button();
            this.Passw = new System.Windows.Forms.TextBox();
            this.RetrieveBtn = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // Number
            // 
            this.Number.Location = new System.Drawing.Point(80, 296);
            this.Number.Name = "Number";
            this.Number.Size = new System.Drawing.Size(56, 20);
            this.Number.TabIndex = 12;
            // 
            // Status
            // 
            this.Status.Location = new System.Drawing.Point(8, 344);
            this.Status.Name = "Status";
            this.Status.Size = new System.Drawing.Size(392, 56);
            this.Status.TabIndex = 16;
            // 
            // label4
            // 
            this.label4.Location = new System.Drawing.Point(8, 96);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(64, 16);
            this.label4.TabIndex = 7;
            this.label4.Text = "Message";
            // 
            // Message
            // 
            this.Message.Location = new System.Drawing.Point(8, 112);
            this.Message.Name = "Message";
            this.Message.Size = new System.Drawing.Size(392, 176);
            this.Message.TabIndex = 6;
            this.Message.Text = "";
            this.Message.WordWrap = false;
            // 
            // label6
            // 
            this.label6.Location = new System.Drawing.Point(8, 328);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(100, 16);
            this.label6.TabIndex = 15;
            this.label6.Text = "Status";
            // 
            // label1
            // 
            this.label1.Location = new System.Drawing.Point(8, 16);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(100, 23);
            this.label1.TabIndex = 0;
            this.label1.Text = "POP Server";
            // 
            // label2
            // 
            this.label2.Location = new System.Drawing.Point(8, 40);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(100, 23);
            this.label2.TabIndex = 1;
            this.label2.Text = "User";
            // 
            // label3
            // 
            this.label3.Location = new System.Drawing.Point(8, 64);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(100, 23);
            this.label3.TabIndex = 2;
            this.label3.Text = "Password";
            // 
            // label5
            // 
            this.label5.Location = new System.Drawing.Point(8, 296);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(80, 16);
            this.label5.TabIndex = 11;
            this.label5.Text = "Mail Number";
            // 
            // ConnectBtn
            // 
            this.ConnectBtn.Location = new System.Drawing.Point(328, 16);
            this.ConnectBtn.Name = "ConnectBtn";
            this.ConnectBtn.Size = new System.Drawing.Size(75, 23);
            this.ConnectBtn.TabIndex = 8;
            this.ConnectBtn.Text = "Connect";
            this.ConnectBtn.Click += new System.EventHandler(this.ConnectBtn_Click);
            // 
            // POPServ
            // 
            this.POPServ.Location = new System.Drawing.Point(80, 16);
            this.POPServ.Name = "POPServ";
            this.POPServ.Size = new System.Drawing.Size(224, 20);
            this.POPServ.TabIndex = 3;
            this.POPServ.Text = "pop.gmail.com";
            // 
            // User
            // 
            this.User.Location = new System.Drawing.Point(80, 40);
            this.User.Name = "User";
            this.User.Size = new System.Drawing.Size(224, 20);
            this.User.TabIndex = 4;
            this.User.Text = "L1nk@bigmir.net";
            // 
            // DisconnectBtn
            // 
            this.DisconnectBtn.Enabled = false;
            this.DisconnectBtn.Location = new System.Drawing.Point(328, 48);
            this.DisconnectBtn.Name = "DisconnectBtn";
            this.DisconnectBtn.Size = new System.Drawing.Size(75, 23);
            this.DisconnectBtn.TabIndex = 9;
            this.DisconnectBtn.Text = "Disconnect";
            this.DisconnectBtn.Click += new System.EventHandler(this.DisconnectBtn_Click);
            // 
            // Passw
            // 
            this.Passw.Location = new System.Drawing.Point(80, 64);
            this.Passw.Name = "Passw";
            this.Passw.PasswordChar = '*';
            this.Passw.Size = new System.Drawing.Size(224, 20);
            this.Passw.TabIndex = 5;
            this.Passw.Text = "333666";
            // 
            // RetrieveBtn
            // 
            this.RetrieveBtn.Enabled = false;
            this.RetrieveBtn.Location = new System.Drawing.Point(152, 296);
            this.RetrieveBtn.Name = "RetrieveBtn";
            this.RetrieveBtn.Size = new System.Drawing.Size(75, 23);
            this.RetrieveBtn.TabIndex = 10;
            this.RetrieveBtn.Text = "Retrieve";
            this.RetrieveBtn.Click += new System.EventHandler(this.RetrieveBtn_Click);
            // 
            // POPForm
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(408, 405);
            this.Controls.Add(this.Status);
            this.Controls.Add(this.label6);
            this.Controls.Add(this.Number);
            this.Controls.Add(this.label5);
            this.Controls.Add(this.RetrieveBtn);
            this.Controls.Add(this.DisconnectBtn);
            this.Controls.Add(this.ConnectBtn);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.Message);
            this.Controls.Add(this.Passw);
            this.Controls.Add(this.User);
            this.Controls.Add(this.POPServ);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.MaximizeBox = false;
            this.Name = "POPForm";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Download Mail via POP3";
            this.ResumeLayout(false);
            this.PerformLayout();
 
        }
        #endregion
 
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main() 
        {
            Application.Run(new POPForm());
        }
 
        private void ConnectBtn_Click(object sender, System.EventArgs e)
        {
            // change cursor into wait cursor
            Cursor cr = Cursor.Current;
            Cursor.Current = Cursors.WaitCursor;
 
            // create server POP3 with port 995
            Server = new TcpClient(POPServ.Text,110);
                    
            Status.Items.Clear();
 
            try
            {
                // initialization
                NetStrm = Server.GetStream();
                RdStrm= new StreamReader(Server.GetStream());
                Status.Items.Add(RdStrm.ReadLine());
 
                // Login Process
                Data = "USER "+ User.Text+CRLF;             
                szData = System.Text.Encoding.ASCII.GetBytes(Data.ToCharArray());
                NetStrm.Write(szData,0,szData.Length);
                Status.Items.Add(RdStrm.ReadLine());
 
                Data = "PASS "+ Passw.Text+CRLF;                
                szData = System.Text.Encoding.ASCII.GetBytes(Data.ToCharArray());
                NetStrm.Write(szData,0,szData.Length);
                Status.Items.Add(RdStrm.ReadLine());
 
                // Send STAT command to get information ie: number of mail and size
                Data = "STAT"+CRLF;             
                szData = System.Text.Encoding.ASCII.GetBytes(Data.ToCharArray());
                NetStrm.Write(szData,0,szData.Length);
                Status.Items.Add(RdStrm.ReadLine());
 
                // change enabled - disabled button
                ConnectBtn.Enabled = false;
                DisconnectBtn.Enabled = true;
                RetrieveBtn.Enabled = true;
 
                // back to normal cursor
                Cursor.Current = cr;
 
            }
            catch(InvalidOperationException err)
            {
                Status.Items.Add("Error: "+err.ToString());
            }
        }
        
 
        private void DisconnectBtn_Click(object sender, System.EventArgs e)
        {
            // change cursor into wait cursor
            Cursor cr = Cursor.Current;
            Cursor.Current = Cursors.WaitCursor;
 
            // Send QUIT command to close session from POP server
            Data = "QUIT"+CRLF;             
            szData = System.Text.Encoding.ASCII.GetBytes(Data.ToCharArray());
            NetStrm.Write(szData,0,szData.Length);
            Status.Items.Add(RdStrm.ReadLine());
 
            //close connection
            NetStrm.Close();
            RdStrm.Close();
 
            // change enabled - disabled button
            ConnectBtn.Enabled = true;
            DisconnectBtn.Enabled = false;
            RetrieveBtn.Enabled = false;
 
            // back to normal cursor
            Cursor.Current = cr;
        }
 
        private void RetrieveBtn_Click(object sender, System.EventArgs e)
        {
            // change cursor into wait cursor
            Cursor cr = Cursor.Current;
            Cursor.Current = Cursors.WaitCursor;    
            string szTemp;                      
            Message.Clear();
            try
            {
                // retrieve mail with number mail parameter
                Data = "RETR "+ Number.Text+CRLF;               
                szData = System.Text.Encoding.ASCII.GetBytes(Data.ToCharArray());
                NetStrm.Write(szData,0,szData.Length);              
 
                szTemp = RdStrm.ReadLine();
                if(szTemp[0]!='-') 
                {
                
                    while(szTemp!=".")
                    {
                        Message.Text += szTemp+CRLF;
                        szTemp = RdStrm.ReadLine();
                    }
                }
                else
                {
                    Status.Items.Add(szTemp);
                }
                            
                // back to normal cursor
                Cursor.Current = cr;
 
            }
            catch(InvalidOperationException err)
            {
                Status.Items.Add("Error: "+err.ToString());
            }
 
        }
       
        public TcpClient Server;
        public NetworkStream NetStrm;
        public StreamReader  RdStrm;
        public string Data;
        public byte[] szData;
        public string CRLF = "\r\n";    
    }
}
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
18.09.2009, 13:53
Ответы с готовыми решениями:

Помогите разобраться с smtp клиентом
mail_to_addr() { local server addr msg local cmds server=&quot;$1&quot; addr=&quot;$2&quot;...

Помогите разобраться
У меня есть координаты North,West,East,South. Мне нужно отобразить их на осях ОХ и ОУ. Допустим я...

Помогите разобраться
Около месяца назад купил 6 освобождённых доменов, 2 нулевых и 4 с PR 2-3. В яндекс добавляются,...

Помогите разобраться
Вот в Яндексе без учета региона мой сайт в ТОП5 по запросу &quot;играми темами программами&quot;, а при учете...

0
18.09.2009, 13:53
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
18.09.2009, 13:53
Помогаю со студенческими работами здесь

помогите разобраться
решил начать изучение AVR только проблема в том, что незнаю неодного языка программирования,что...

Помогите разобраться с БП
Всем доброго времени суток. Столкнулся с такой проблемой: Как то в недалеком прошлом я приобрел...

помогите разобраться
у меня есть блог http://motoexpert.ru когда делаю анализ сайта то в разделе Проиндексированные...

помогите разобраться
uses SysUtils; type mas=array of string; function CHISLO (var s:string;var b:mas;var...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
1
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru