Skip to content

Commit

Permalink
Merge pull request #14 from mateusvicente100/master
Browse files Browse the repository at this point in the history
Property to control message id
  • Loading branch information
juliosenha authored Jan 19, 2024
2 parents 582c930 + 8876dd6 commit 9caa665
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Mail4Delphi.pas
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ TMail = class(TInterfacedObject, IMail)
FSSL: Boolean;
FAuth: Boolean;
FReceiptRecipient: Boolean;
FMessageId: string;
function AddTo(const AMail: string; const AName: string = ''): IMail;
function From(const AMail: string; const AName: string = ''): IMail;
function ReceiptRecipient(const AValue: Boolean): IMail;
Expand Down Expand Up @@ -140,7 +141,7 @@ function TMail.Host(const AHost: string): IMail;

function TMail.MessageId(const AMessageId: string): IMail;
begin
FIdMessage.MsgId := AMessageId;
FMessageId := AMessageId;
Result := Self;
end;

Expand Down Expand Up @@ -327,6 +328,7 @@ constructor TMail.Create;
FSSL := False;
FAuth := False;
FReceiptRecipient := False;
FMessageId := EmptyStr;
end;

destructor TMail.Destroy;
Expand Down Expand Up @@ -360,6 +362,8 @@ function TMail.SendMail: Boolean;
LImplicitConnection := Self.Connect;
try
try
if not FMessageId.Trim.IsEmpty then
FIdMessage.MsgId := FMessageId;
FIdSMTP.Send(FIdMessage);
Result := True;
except
Expand Down

0 comments on commit 9caa665

Please sign in to comment.