Разработка программы обновления программного обеспечения
Дипломная работа - Компьютеры, программирование
Другие дипломы по предмету Компьютеры, программирование
Click(Sender: TObject);
{ Private declarations }
{ Public declarations };
: TForm1;
Math, adress, em;
{$R *.dfm}
KOI8_RToUTF16Str(const s: string): WideString;,j: integer;:= length(s);(Result,j);i:=1 to j do[i]:=KOI8_RToUTF16Char(s[i]);;
DecodeStr(Text: string): string;, Dec: string;,P2:Integer;:=Text;:='';
pos('=?windows-1251?',Temp)>0 do:=pos('=?windows-1251?',Temp);
// P2:=pos('?=',Copy(Temp,P,Length(Temp)))+P;:=pos('?=',Temp);:=Copy(Temp,p+17,P2-(P+17));:=Form1.IdDecoderMIME1.DecodeString(Dec);:=Result+Copy(Temp,1,P-1)+Dec;:=Copy(Temp,P2+2,length(Temp));;:=Result+Temp;:=Result;
:='';pos('=?koi8-r?',Temp)>0 do:=pos('=?koi8-r?',Temp);:=pos('?=',Temp);:=Copy(Temp,p+11,P2-(P+11));Dec<>''Dec:=KOI8_RToUTF16Str(Form1.IdDecoderMIME1.DecodeString(Dec));
;:=Result+Copy(Temp,1,P-1)+Dec;:=Copy(Temp,P2+2,length(Temp));;:=Result+Temp;;
TForm1.FormCreate(Sender: TObject);.Title:='Проверка/Отправка почты (POP3, IMAP)';
//.Items.LoadFromFile(ExtractFilePath(ParamStr(0))+'emails.txt');.Selected[0]:=true;
;;
TForm1.Button4Click(Sender: TObject);.ShowModal;;
TForm1.ListBox1DblClick(Sender: TObject);.ShowModal;;
TForm1.Button5Click(Sender: TObject);: integer;MessageDlg('Вы действительно хотите удалить адрес?', mtConfirmation,
[mbYes, mbNo],0)=mrNoExiti:=0 to Form1.ListBox1.Items.Count-1 doForm1.ListBox1.Selected[i].Items.Delete(i);.Items.SaveToFile(ExtractFilePath(ParamStr(0))+'emails.txt'); ;;;;;
TForm1.Button3Click(Sender: TObject);.Items.Add('new@new.ru|new.mail.ru|user|password|POP3');;
TForm1.Button2Click(Sender: TObject);: integer;,usr: string;: boolean;.Clear;:=false;i:=0 to Form1.ListBox1.Items.Count-1 doForm1.ListBox1.Selected[i]:=Form1.ListBox1.Items.Strings[i];;;;
//.Port:=25;.Port:=110;
//:=Copy(s,1,pos('|',s)-1);(s,1,pos('|',s));.Host:=Copy(s,1,pos('|',s)-1);.Host:=IdIMAP41.Host;
//(s,1,pos('|',s));.Username:=Copy(s,1,pos('|',s)-1);.Username:=IdIMAP41.Username;
//(s,1,pos('|',s));.Password:=Copy(s,1,pos('|',s)-1);.Password:=IdIMAP41.Password;
//(s,1,pos('|',s));s='POP3'imap:=falses='IMAP'imap:=true;
//////////////////////////////////////// проверка почты.Clear;.Enabled:=true;.Interval:=1000*60*5; // раз в 5 минутimap=true.Connect(30000);.SelectMailBox('INBOX');.RetrieveAllHeaders(IdIMAP41.MailBox.MessageList);
//IdIMAP41.MailBox.MessageList.Count=0
then ShowMessage('В папке 0 сообщений!');
end.Connect(1000);IdPOP31.CheckMessages=0ShowMessage('В папке 0 сообщений!');;imap=true//IMAP4.Lines.Add('------------------------------------------------------------------------------------------------------------------------------------------------------------------------');.Lines.Add('Имя почтового ящика (IMAP): '+usr+' (всего сообщений: '+IntToStr(IdIMAP41.MailBox.MessageList.Count)+')');.Lines.Add('------------------------------------------------------------------------------------------------------------------------------------------------------------------------');i:=0 to IdIMAP41.MailBox.MessageList.Count-1 do.Lines.Add(' '+IntToStr(i+1)+': От: '+DecodeStr(IdIMAP41.MailBox.MessageList.Messages[i].From.Text));.Lines.Add(' Адрес: '+DecodeStr(IdIMAP41.MailBox.MessageList.Messages[i].From.Address));.Lines.Add(' Имя: '+DecodeStr(IdIMAP41.MailBox.MessageList.Messages[i].From.Name));.Lines.Add(' Тема: '+DecodeStr(IdIMAP41.MailBox.MessageList.Messages[i].Subject));.Lines.Add(' Сервер: '+DecodeStr(IdIMAP41.MailBox.MessageList.Messages[i].MsgId));.Lines.Add(' Attachement Encoding: '+DecodeStr(IdIMAP41.MailBox.MessageList.Messages[i].AttachmentEncoding));.Lines.Add(' Charset: '+DecodeStr(IdIMAP41.MailBox.MessageList.Messages[i].CharSet));.Lines.Add(' Текст сообщения: '+DecodeStr(IdIMAP41.MailBox.MessageList.Messages[i].Body.Text));.Lines.Add(' ');;.Disconnect;//POP3.Lines.Add('------------------------------------------------------------------------------------------------------------------------------------------------------------------------');
Memo2.Lines.Add('Имя почтового ящика (POP): '+usr+' (всего сообщений: неизвестно)');
Memo2.Lines.Add('------------------------------------------------------------------------------------------------------------------------------------------------------------------------');i:=1 to IdPOP31.CheckMessages do.Clear;.RetrieveHeader(i,IdMessage1);.Lines.Add(' '+IntToStr(i)+': От: '+DecodeStr(IdMessage1.From.Text));.Lines.Add(' Адрес: '+DecodeStr(IdMessage1.From.Address));.Lines.Add(' Имя: '+DecodeStr(IdMessage1.From.Name));.Lines.Add(' Тема: '+DecodeStr(IdMessage1.Subject));.Lines.Add(' Сервер: '+DecodeStr(IdMessage1.MsgId));.Lines.Add(' Attachement Encoding: '+DecodeStr(IdMessage1.AttachmentEncoding));.Lines.Add(' Charset: '+DecodeStr(IdMessage1.CharSet));.Lines.Add(' Текст сообщения: '+DecodeStr(IdMessage1.Body.Text));.Lines.Add(' ');;.Disconnect;;
;;
TForm1.Button6Click(Sender: TObject);.ShowModal;;
adress;
, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,, StdCtrls;
= class(TForm): TEdit;: TLabel;: TLabel;: TEdit;: TLabel;: TEdit;: TLabel;: TEdit;: TButton;: TRadioButton;: TRadioButton;FormShow(Sender: TObject);Button1Click(Sender: TObject);
{ Private declarations }
{ Public declarations };
: TForm2;
Unit1;
{$R *.dfm}
TForm2.FormShow(Sender: TObject);: integer;: string;i:=0 to Form1.ListBox1.Items.Count-1 doForm1.ListBox1.Selected[i]:=Form1.ListBox1.Items.Strings[i];
//.Text:=Copy(s,1,pos('|',s)-1);(s,1,pos('|',s));.Text:=Copy(s,1,pos('|',s)-1);(s,1,pos('|',s));.Text:=Copy(s,1,pos('|',s)-1);(s,1,pos('|',s));.Text:=Copy(s,1,pos('|',s)-1);(s,1,pos('|',s));s='POP3'RadioButton1.Checked:=trues='IMAP'RadioButton2.Checked:=trueRadioButton1.Checked:=true;Edit1.Text=''Edit1.Text:=Form1.ListBox1.Items.Strings[i];
//;;;;
TForm2.Button1Click(Sender: TObject);: integer;: string;i:=0 to Form1.ListBox1.Items.Count-1 doForm1.ListBox1.Selected[i](Edit1.Text''):=Edit1.Text+'|'+Edit2.Text+'|'+Edit3.Text+'|'+Edit4.Text;RadioButton1.Checkeds:=s+'|'+'POP3's:=s+'|'+'IMAP';.ListBox1.Items.Strings[i]:=s;.ListBox1.Items.SaveToFile(ExtractFilePath(ParamStr(0))+'emails.txt');
else ShowMessage('Одно из полей не заполнено!');
Break;;;; ;
.
em;
, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,, IdComponent, IdTCPConnection, IdTCPClient, IdMessageClient,, ComCtrls, StdCtrls, Buttons, ExtCtrls, IdBaseComponent, IdMessage;
= class(TForm): TIdMessage;: TIdSMTP;: TOpenDialog;: TLabeledEdit;: TLabeledEdit;: TLabeledEdit;: TLabeledEdit;: TLabeledEdit;: TLabeledEdit;: TMemo;: TLabel;: TBitBtn;: TMemo;: TButton;: TLabeledEdit;: TLabeledEdit;btnSendMailClick(Sender: TObject);SMTPStatus(ASender: TObject; const AStatus: TIdStatus;AStatusText: string);Button1Click(Sender: TObject);
{ Public declarations };
: TForm3;
{$R *.dfm}
TForm3.btnSendMailClick(Sender: TObject);.Clear;
// установка SMTP.Host:=ledHost.Text;.Port:=25;
// установка сообщения.AuthenticationType:=atLogin; // atNone.Username:=LabeledEdit1.Text;.Password:=LabeledEdit2.Text;
//.From.Name:=ledFrom.Text;.Subject:=ledSubject.Text; // тема.From.Address:=ledFrom.Text; // адрес отправителя.Recipients.EMailAddresses:=ledTo.Text+','+ledCC.Text; // получатель + копия.Body.Text:=Memo2.Text; // текст сообщенияFileExists(ledAttachment.Text)TIdAttachment.Create(MailMessage.MessageParts,ledAttachment.Text);
// отправка почты.Connect(1000);.Send(MailMessage);('Письмо отправлено!');on E:Exception do.Lines.Insert(0,'Статус отправки: ERROR - '+E.Message);('Письмо не отправлено!');
end;;SMTP.ConnectedSMTP.Disconnect;;;
TForm3.SMTPStatus(ASender: TObject; const AStatus: TIdStatus;AStatusText: string);.Lines.Insert(0,'Статус отправки: '+AStatusText);;
TForm3.Button1Click(Sender: TObject);AttachmentDialog.ExecuteledAttachment.Text:=AttachmentDialog.FileName;;
.
ПРИЛОЖЕНИЕ Б
Рисунок 1 - Вид экранной формы Учет ходящих электронных писем
Рисунок 2 - Вид экранной формы Добавление
Рисунок 3 - Вид экранной формы сообщения пользователю об ошибке при добавлении новой строки поключения, не со всеми введенными данными
Рисунок 4 - Вид экранной формы Изменение
Рисунок 5 - Вид экранной формы сообщения пользователю об ошибке при изменении существующей строки поключения, не со всеми введенными данными
Рисунок 6 - Вид экранной формы Открыть.
Рису?/p>