diff --git a/src/Mail4Delphi.pas b/src/Mail4Delphi.pas index 057b7bd..1ce35c8 100644 --- a/src/Mail4Delphi.pas +++ b/src/Mail4Delphi.pas @@ -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; @@ -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; @@ -327,6 +328,7 @@ constructor TMail.Create; FSSL := False; FAuth := False; FReceiptRecipient := False; + FMessageId := EmptyStr; end; destructor TMail.Destroy; @@ -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