03-26-2008, 23:00: PM
Delphi'de Yaptığınız Programlar İle Mail Gönderin
Delphi'de Yaptığınız Programlar İle Mail Gönderinunit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, IdMessage, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdMessageClient, IdSMTP;
type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
Button3: TButton;
IdSMTP1: TIdSMTP;
IdMessage1: TIdMessage;
OpenDialog1: TOpenDialog;
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button3Click(Sender: TObject);
begin
Close;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
Edit3.Text:=OpenDialog1.FileName;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
IdMessage1.Clear;
IdMessage1.From.Text :=Edit1.Text;
IdMessage1.ReplyTo.EMailAddresses:=Edit1.Text;
IdMessage1.Recipients.EMailAddresses:=Edit2.Text;
IdMessage1.Date:=Date;
IdMessage1.Subject:=Edit4.Text;
IdMessage1.Priority:=mpNormal;
if not (Edit3.Text=") then TIdAttachment.Create(IdMessage1.MessageParts,Edit3 .Text); IdMessage1.Body.Assign(Memo1.Lines);
//Connexion au serveur smtp
IdSMTP1.AuthenticationType:=atLogin;
IdSMTP1.Host:='xxxx';
IdSMTP1.Port:=25;
IdSMTP1.UserName:='xxxx';
IdSMTP1.Password:='xxxx';
IdSMTP1.Connect;
try
IdSMTP1.Send(IdMessage1);
finally
IdSMTP1.Disconnect;
end;
end;
end.
Delphi'de Yaptığınız Programlar İle Mail Gönderinunit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, IdMessage, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdMessageClient, IdSMTP;
type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
Button3: TButton;
IdSMTP1: TIdSMTP;
IdMessage1: TIdMessage;
OpenDialog1: TOpenDialog;
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button3Click(Sender: TObject);
begin
Close;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
Edit3.Text:=OpenDialog1.FileName;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
IdMessage1.Clear;
IdMessage1.From.Text :=Edit1.Text;
IdMessage1.ReplyTo.EMailAddresses:=Edit1.Text;
IdMessage1.Recipients.EMailAddresses:=Edit2.Text;
IdMessage1.Date:=Date;
IdMessage1.Subject:=Edit4.Text;
IdMessage1.Priority:=mpNormal;
if not (Edit3.Text=") then TIdAttachment.Create(IdMessage1.MessageParts,Edit3 .Text); IdMessage1.Body.Assign(Memo1.Lines);
//Connexion au serveur smtp
IdSMTP1.AuthenticationType:=atLogin;
IdSMTP1.Host:='xxxx';
IdSMTP1.Port:=25;
IdSMTP1.UserName:='xxxx';
IdSMTP1.Password:='xxxx';
IdSMTP1.Connect;
try
IdSMTP1.Send(IdMessage1);
finally
IdSMTP1.Disconnect;
end;
end;
end.