unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdMessageClient, IdSMTP, IdMessage;
type
TForm1 = class(TForm)
IdSMTP1: TIdSMTP;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
CheckBox1: TCheckBox;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button1: TButton;
GroupBox2: TGroupBox;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Memo1: TMemo;
IdMessage1: TIdMessage;
OpenDialog1: TOpenDialog;
ListBox1: TListBox;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
idsmtp1.Host:=edit1.Text;
idsmtp1.Username:=edit2.Text;
idsmtp1.Password:=edit3.Text;
if checkbox1.Checked then
idsmtp1.AuthenticationType:=atlogin
else
idsmtp1.AuthenticationType:=atnone;
idmessage1.From.Address:=edit4.Text;
idmessage1.Recipients.EMailAddresses:=edit5.Text;
idmessage1.Subject:=edit6.Text;
idmessage1.Body.Assign(memo1.Lines);
try
idsmtp1.Connect;
except
showmessage('baglantı saglanamadı');
end;
try
idsmtp1.Send(idmessage1);
showmessage('mail gönderildi');
finally
idsmtp1.Disconnect;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if opendialog1.Execute then
begin
listbox1.Items.Add(opendialog1.FileName);
tidattachment.create(idmessage1.messageparts,opendialog1.filename);
end;
end;
end.
çok güzel bişey oldu bende kullanayım bari :yo
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdMessageClient, IdSMTP, IdMessage;
type
TForm1 = class(TForm)
IdSMTP1: TIdSMTP;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
CheckBox1: TCheckBox;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button1: TButton;
GroupBox2: TGroupBox;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Memo1: TMemo;
IdMessage1: TIdMessage;
OpenDialog1: TOpenDialog;
ListBox1: TListBox;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
idsmtp1.Host:=edit1.Text;
idsmtp1.Username:=edit2.Text;
idsmtp1.Password:=edit3.Text;
if checkbox1.Checked then
idsmtp1.AuthenticationType:=atlogin
else
idsmtp1.AuthenticationType:=atnone;
idmessage1.From.Address:=edit4.Text;
idmessage1.Recipients.EMailAddresses:=edit5.Text;
idmessage1.Subject:=edit6.Text;
idmessage1.Body.Assign(memo1.Lines);
try
idsmtp1.Connect;
except
showmessage('baglantı saglanamadı');
end;
try
idsmtp1.Send(idmessage1);
showmessage('mail gönderildi');
finally
idsmtp1.Disconnect;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if opendialog1.Execute then
begin
listbox1.Items.Add(opendialog1.FileName);
tidattachment.create(idmessage1.messageparts,opendialog1.filename);
end;
end;
end.
çok güzel bişey oldu bende kullanayım bari :yo