-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDemo2_0.pas
More file actions
55 lines (42 loc) · 1.25 KB
/
Demo2_0.pas
File metadata and controls
55 lines (42 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
unit Demo2_0;
interface
type
// I know nothing about source of mail addresses, I am independent object. I know only TMailSenderMessage
// You can change and test me independently
TMailSender = class
public
constructor Create;
destructor Destroy; override;
procedure SendMail(aTitle, aText: String);
end;
implementation
uses MessageBus, Demo2_1, Classes, SysUtils;
constructor TMailSender.Create;
begin
inherited;
end;
destructor TMailSender.Destroy;
begin
inherited;
end;
procedure TMailSender.SendMail(aTitle, aText: String);
var
aMessage: TMailSenderMessage;
i: Integer;
begin
aMessage := TMailSenderMessage.Create(msfTwo);
try
aMessage.SecondFilter :=
function(aMail: String): Boolean
begin
Result := aMail.ToUpper.EndsWith('.PL'); // set break here
end;
TMessageBus.Default.Send<TMailSenderMessage>(TMailSenderMessage.MB_MAILSENDER, aMessage);
for i := 0 to aMessage.MailList.Count - 1 do begin // set break here
// SendProcedure(aTitle, aText, aMessage.MailList.Names[i], aMessage.MailList.ValueFromIndex[i])
end;
finally
aMessage.Free;
end;
end;
end.