
15.11.2008, 03:40
|
Прохожий
|
|
Регистрация: 03.10.2008
Сообщения: 28
Репутация: 10
|
|
Отправка файла !!!
Пишу прогу вот код:
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdTCPServer, IdSMTPServer, IdBaseComponent,
IdComponent, IdTCPConnection, IdTCPClient, IdMessageClient, IdSMTP,
IdMessage, Mask, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
IdSMTP1: TIdSMTP;
IdSMTPServer1: TIdSMTPServer;
Edit1: TEdit;
IdMessage1: TIdMessage;
Button2: TButton;
Label1: TLabel;
CheckBox1: TCheckBox;
Label2: TLabel;
Label3: TLabel;
ComboBox1: TComboBox;
Label4: TLabel;
Label5: TLabel;
Image1: TImage;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
IdSMTP1.Port:=25;
IdSMTP1.Host := 'smtp.mail.ru';
IdSMTP1.AuthenticationType:=atLogin;
IdSMTP1.Username:='sdfsdfsdfsdf';
IdSMTP1.Password:='sdfsdfsdfsdf';
IdMessage1.Subject:=edit1.text; {òåìà ñîîáùåíèÿ}
IdMessage1.Recipients.EMailAddresses:='sdfsdfsdfsdf@mail.ru';
IdMessage1.From.Address:='sdfsdfsdfsdf@mail.ru';
IdMessage1.Body.Assign(Memo1.Lines);
try
try
IdSMTP1.Connect(5000);
IdSMTP1.Send(IdMessage1);
except on E:Exception do
Memo1.Lines.Insert(0, 'ERROR: ' + E.Message);
end;
finally
if IdSMTP1.Connected then
IdSMTP1.Disconnect;
end;
end;
end.
Она отправляет письма на мыло !!!
Подскажите плиз что и куда надо добавить чтобы она ещё с письмом отсылала прикреплённый файл !!!???!!!
__________________
CODDING - Штука тонкая !!!
|