Gmaile bağlanırken Connection Closed Gracefully hatası alıyorum, Bunu çözemedim,
Gönder Butonuna ikinci defa bastığımda mail gidiyor.
Uygulama Mail Gönder Butonuna birinci basışta göndermiyor 2. Basışta Hata vermeden gönderiyor. Nedir bunun hikmeti.
Gönder Butonuna ikinci defa bastığımda mail gidiyor.
Uygulama Mail Gönder Butonuna birinci basışta göndermiyor 2. Basışta Hata vermeden gönderiyor. Nedir bunun hikmeti.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdMessage, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdMessageClient, IdSMTP, IdIOHandler,
IdIOHandlerSocket, IdSSLOpenSSL, ComCtrls;
type
TForm1 = class(TForm)
SMTP: TIdSMTP;
IdMsgSend: TIdMessage;
Button1: TButton;
IdSSLIOHandlerSocket1: TIdSSLIOHandlerSocket;
Memo1: TMemo;
Kimden: TEdit;
Label1: TLabel;
Label2: TLabel;
ListBox1: TListBox;
Button2: TButton;
pFileDlg: TOpenDialog;
Kime: TComboBox;
StatusBar1: TStatusBar;
Label3: TLabel;
konu: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
atasment:TIdAttachment;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if not smtp.Connected then begin
with IdMsgSend do
begin
try
ReplyTo.EMailAddresses := Kimden.Text; // Ön ayarlandı
Recipients.EMailAddresses := Kime.Text; // alıcıların virgülle ayrılmış mail adresleri buraya
// SMTP.Disconnect;
Subject := Konu.Text +' - ' +datetimetostr(now); { Subject: header }
Body.Text:=(Memo1.Lines.Text + datetimetostr(now));
Priority := TIdMessagePriority(mphigh); { Message Priority }
CCList.EMailAddresses := Kime.Text; {CC}
// BccList.EMailAddresses := edtBCC.Text; {BBC}
// ATASMENT:= TIdAttachment.Create(IdMsgSEND.MessageParts, 'c:\xS.DOCX');
// ATASMENT.ContentType:='multipart/alternative'; //
{authentication settings}
SMTP.AuthenticationType := atLogin; {Simple Login}
SMTP.Connect;
SMTP.Send(IdMsgSend);
except
showmessage('Mesaj gitmedi Tekrar Dene!');
abort;
end;
try
finally
StatusBar1.Panels.Items[0].Text:='Mesaj Gönderildi';
SMTP.Disconnect;
end;
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i:integer;
fileName : string;
begin
if pFileDlg.Execute() then begin
fileName := pFileDlg.FileName;
FOR I:=0 TO pFileDlg.Files.Count-1 DO BEGIN
LISTBOX1.Items.Add(pFileDlg.Files.Strings[I]);
END;
END;
for i := 0 to listbox1.items.count-1 do begin
ATASMENT:= TIdAttachment.Create(IdMsgSend.MessageParts, listbox1.items.strings[i]);
ATASMENT.ContentType:='multipart/alternative'; //
end;
end;
end.
__________________________
From Now I will only Reading.
From Now I will only Reading.

