delphi4arab منتديات دلفي للعرب
سورس لارسال اميل به مشكل - نسخة قابلة للطباعة

+- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum)
+-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3)
+--- قسم : سؤال و جواب حول دلفي (https://delphi4arab.net/forum/forumdisplay.php?fid=15)
+--- الموضوع : سورس لارسال اميل به مشكل (/showthread.php?tid=2152)



سورس لارسال اميل به مشكل - Benhlell - 29-06-2010

اخوتي هذا سورس لارسال اميل لكن المشكل فيه غريب ؟
هل من الممكن تصحيحه
لعل المشكل في ملاء الفراغات مثل host *****:monster2:


سورس لارسال اميل به مشكل - محمد عبد العزيز - 01-07-2010


السلام عليكم ورحمة الله

لارسال بريد تحتاج لخادم وما يلزك من صلاحيات
إطلع أكثر على مواثيق البريد smtp و pop

وبالتوفيق



سورس لارسال اميل به مشكل - andreo - 01-07-2010

أكتب السورس هنا لنرى


سورس لارسال اميل به مشكل - Benhlell - 03-07-2010

مع اني وضعتو في المرفقات
PHP كود :
unit mainunit;

interface

uses
  inifiles
, windows, messages, sysutils, variants, classes, graphics, controls, forms,
  
dialogs, idcomponent, idtcpconnection, idtcpclient, idmessageclient,
  
idsmtp, comctrls, stdctrls, buttons, extctrls, idbasecomponent, idmessage;

type
  tmailerform 
= class(tform)
    
mailmessage: Tidmessage;
    
pnltop: Tpanel;
    
pnlbottom: Tpanel;
    
ledhost: Tlabelededit;
    
body: Tmemo;
    
ledattachment: Tlabelededit;
    
btnattachment: Tbitbtn;
    
smtp: Tidsmtp;
    
ledfrom: Tlabelededit;
    
ledto: Tlabelededit;
    
ledcc: Tlabelededit;
    
ledsubject: Tlabelededit;
    
btnsendmail: Tbitbtn;
    
statusmemo: Tmemo;
    
attachmentdialog: Topendialog;
    
procedure btnsendmailclick(sender: Tobject);
    
procedure smtpstatus(asender: Tobject; const astatus: Tidstatus;
      const 
astatustext: String);
    
procedure btnattachmentclick(sender: Tobject);
    
procedure formcreate(sender: Tobject);
    
procedure formclose(sender: Tobject; var action: Tcloseaction);
  private
    
procedure getsettings;
    
procedure savesettings;
  public
    { public 
declarations }
  
end;

var
  
mailerform: Tmailerform;

implementation

{$r *.dfm}

procedure tmailerform.btnsendmailclick(sender: Tobject);
begin
  statusmemo
.clear;

  
//setup smtp
  
smtp.host := ledhost.text;
  
smtp.port := 25;

  
//setup mail message
  
mailmessage.from.address := ledfrom.text;
  
mailmessage.recipients.emailaddresses := ledto.text + ',' + ledcc.text;

  
mailmessage.subject := ledsubject.text;
  
mailmessage.body.text := body.text;

  if 
fileexists(ledattachment.text) then
    tidattachment
.create(mailmessage.messageparts, ledattachment.text);

  
//send mail
  
try
    try
      
smtp.connect(1000);
      
smtp.send(mailmessage);
    
except on e:exception do
      
statusmemo.lines.insert(0, 'error: ' + e.message);
    
end;
  finally
    if 
smtp.connected then smtp.disconnect;
  
end;

end; (* btnsendmail click *)

procedure tmailerform.smtpstatus(asender: Tobject; const astatus: Tidstatus;
  const 
astatustext: String);
begin
  statusmemo
.lines.insert(0,'status: ' + astatustext);
end; (* smtp status *)

procedure tmailerform.btnattachmentclick(sender: Tobject);
begin
  
if attachmentdialog.execute then
    ledattachment
.text := attachmentdialog.filename;
end;

procedure tmailerform.formcreate(sender: Tobject);
begin
  getsettings
;
end;

procedure tmailerform.formclose(sender: Tobject; var action: Tcloseaction);
begin
  savesettings
;
end;

procedure tmailerform.getsettings;
var
  
ini : Tinifile;
begin
  ini 
:= tinifile.create(changefileext(application.exename,'.ini'));
  try
    
ledhost.text := ini.readstring('smtp','host','');

    
ledfrom.text := ini.readstring('mail','from','');
    
ledto.text := ini.readstring('mail','to','');
    
ledcc.text := ini.readstring('mail','cc','');
  finally
    
ini.free;
  
end;
end; (* getsettings *)

procedure tmailerform.savesettings;
var
  
ini : Tinifile;
begin
  ini 
:= tinifile.create(changefileext(application.exename,'.ini'));
  try
    
ini.writestring('smtp','host',ledhost.text);

    
ini.writestring('mail','from',ledfrom.text);
    
ini.writestring('mail','to',ledto.text);
    
ini.writestring('mail','cc',ledcc.text);
  finally
    
ini.free;
  
end;
end; (* savesettings *)

end 



سورس لارسال اميل به مشكل - TF6M - 27-09-2010

السلام عليكم
كما قال الأخ B.M.AbdelAziZ , يجب الإطلاع على مواثيق
البريد POP & SMTP (نظرة سريعه في ويكي !) .
- المشروع كامل : هنا (ما هي رسالة الخطأ ؟)
- يمكن إستخدام Outlook أو OLE Object أو حتى مكونات دلفي (indy, fastnet ..... ect)
- هده طريقة بسيطة بإستخدام Cmd :
PHP كود :
1- Type telnet server.com 25 
2
- Type HELO server.com.
3- Type MAIL FROM:you@server.com.
4- Type RCPT TO:Friend1@anotherserver.com, friend_two@someotherserver.org, 
                
friend.3three@Someserver.com, etc.
5- To write the message, type "DATA" and press Enter.  

   
1. On the first line type SUBJECT:yoursubject and press Enter twice.
   
2. Continue typing your message.
   
3. Put a single period (.) on a line by itself and press Enter to send your message.
The server should say 'Message accepted for delivery'.
(Or 
it says 250 OK id=`a long id`).
6- Type QUIT to exit Telnet. 
بالتوفيق,,


سورس لارسال اميل به مشكل - bibill - 29-09-2010

السلام عليكم :

المشكلة في smtp ربما السيرفر محمي أو شئ من هذا
لا أعرف الحل
وفقكم الله .