16-01-2014, 01:02 PM
ابسط فكرة
لازم تعمل حساب ايمايل للبرنامج و بعدها تسجل دخول اليه و ترسل رسائل عبره برمجياا
ادا تريد كود جهاز فهدا ابسط ما وجدت
المصدر
لازم تعمل حساب ايمايل للبرنامج و بعدها تسجل دخول اليه و ترسل رسائل عبره برمجياا
ادا تريد كود جهاز فهدا ابسط ما وجدت
كود :
procedure TForm1.btnSendClick(Sender: TObject);
var Attachment: TIdAttachment;
i:Integer;
begin
Memo2.Clear;
IdSMTP1.Host:='smtp.*****.com';
IdSMTP1.Port:=465;
IdSMTP1.Username:=edt1.Text;
IdSMTP1.Password:=edt2.Text;
IdMessage1.Body.Text:=Memo1.Text;
IdMessage1.From.Text:=edt1.text+'@*****.com';
if chk2.Checked then
for i := 0 to lst2.Items.Count-1 do
IdMessage1.Recipients.Add.Address:=lst2.Items.Strings[i]
else
IdMessage1.Recipients.EMailAddresses:=edt1.text+'@*****.com';
IdMessage1.Subject:=edt3.Text;
IdMessage1.Date:=Date;
if chk1.Checked then
for i := 0 to lst1.Items.Count-1 do
Attachment := TIdAttachmentFile.Create(IdMessage1.MessageParts,lst1.Items.Strings[i]);
try
IdSMTP1.Connect;
try
if IdSMTP1.Connected then begin
Memo2.Lines.Add(TimeToStr(Time)+ ' : '+ 'Please wait while the email is sending...');
IdSMTP1.Send(IdMessage1);
Memo2.Lines.Add(TimeToStr(Time)+ ' : '+ 'Mail sent.')
end;
except
on e:Exception do begin
stat1.Panels[0].Text:=e.Message;
Memo2.Lines.Add(TimeToStr(Time)+ ' : '+ e.Message)
end;
end;
finally
IdSMTP1.Disconnect();
Attachment.Free;
end;إقتباس :hxxp://www.youtube.com/watch?v=faNoVQO_Vvo
.:: مبرمج شوارع ::.

