Synapse مجموعة من مكتبات اﻷتصال بالشبكة تعمل مع دلفي ولازاروس
تحتوي علي وحدة smtpsend لارسال البريد اﻷلكتروني من برنامجك مباشرة
حمل المكتبة من هنا
http://synapse.ararat.cz/doku.php/download
إذا كان بريدك اﻷلكتروني يحتاج SSL عليك تثبيت libssl-dev في أوبنتو وما يكافئها في اﻷنظمة اﻷخري
مكتبة Synapse لا تثبت في الـ IDE مثل باقي المكونات وانما تضاف إلي المشروع اللذي تعمل عليه
من قائمة Project >>> Project Options >>> Paths
ثم أضف الوحدتين 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;