![]() |
|
إرسال بريد إلكتروني عن طريق Synapse - نسخة قابلة للطباعة +- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum) +-- قسم : متتديات باسكال Pascal (https://delphi4arab.net/forum/forumdisplay.php?fid=7) +--- قسم : Lazarus - Free Pascal - CrossKylix - Kylix - CrossVCL (https://delphi4arab.net/forum/forumdisplay.php?fid=34) +--- الموضوع : إرسال بريد إلكتروني عن طريق Synapse (/showthread.php?tid=5119) |
إرسال بريد إلكتروني عن طريق Synapse - a.atalla - 09-04-2013 Synapse مجموعة من مكتبات اﻷتصال بالشبكة تعمل مع دلفي ولازاروس تحتوي علي وحدة smtpsend لارسال البريد اﻷلكتروني من برنامجك مباشرة حمل المكتبة من هنا كود : http://synapse.ararat.cz/doku.php/downloadإذا كان بريدك اﻷلكتروني يحتاج SSL عليك تثبيت libssl-dev في أوبنتو وما يكافئها في اﻷنظمة اﻷخري مكتبة Synapse لا تثبت في الـ IDE مثل باقي المكونات وانما تضاف إلي المشروع اللذي تعمل عليه من قائمة Project >>> Project Options >>> Paths كود : http://i.imgur.com/EQCr6B8.pngثم أضف الوحدتين smtpsend,ssl_openssl لقسم uses ثم كود اﻷرسال كود : Uses
smtpsend,ssl_openssl; // Add these two units to the uses section
.
.
.
.
procedure TForm1.Button1Click(Sender: TObject);
var
smtp:TSMTPSend;
msg_lines:TStringList;
begin
smtp:=TSMTPSend.Create;
msg_lines:=TStringList.Create;
// Formatting the message body
msg_lines.Insert(0, 'From: XXXXXX ');
msg_lines.Insert(1, 'To: XXXXXXX ' );
msg_lines.Insert(2,' Test SMTPSEND from Synapse ');
try
smtp.UserName:='your_email@*****.com';
smtp.Password:='your_password';
smtp.TargetHost:='smtp.*****.com';
smtp.TargetPort:='465'; // if not using ssl port=25
smtp.AutoTLS:=True;
smtp.FullSSL:=True;
if smtp.Login then
begin
smtp.MailFrom('your_email@*****.com',Length('your_email@*****.com'));
smtp.MailTo('receiver_email');
smtp.MailData(msg_lines);
if smtp.Logout then
ShowMessage('Message Sent and logged out');
end;
finally
msg_lines.Free;
smtp.Free;
end;
end; |