X-Git-Url: http://git.megabrutal.com/?p=mgsmtp.git;a=blobdiff_plain;f=Common.pas;fp=Common.pas;h=76926728bcbeddd3042f36a2bca0ff8be1e73b50;hp=8e0b7fb443ffa93db0871a7522e42a007bbc40f6;hb=7e2904763170597795d8c117d938cb6e4b86b3b7;hpb=6f8e6026b5d35a3fa41a124032caed6621a9f86e diff --git a/Common.pas b/Common.pas index 8e0b7fb..7692672 100644 --- a/Common.pas +++ b/Common.pas @@ -138,6 +138,7 @@ type procedure AddRecipient(Recipient: TRecipient); overload; procedure SetReturnPath(Address: string); procedure SetRecipientData(Index, Data: integer; RMsg: string = ''); + procedure SetAllRecipientData(Data: integer; RMsg: string = ''); procedure SetRelayHost(HostName: string); property ReturnPath: string read FReturnPath write SetReturnPath; property RelayHost: string read FRelayHost write SetRelayHost; @@ -154,7 +155,7 @@ type function EMailTimeStamp(DateTime: TDateTime): string; function EMailTimeStampCorrected(DateTime: TDateTime): string; function StatusToStr(Status: integer): string; - procedure AssignDeliveryStatusToSMTPCodes(Envelope: TEnvelope); + procedure AssignDeliveryStatusToSMTPCodes(Envelope: TEnvelope; TransactionComplete: boolean); function CleanEOLN(S: string): string; function GenerateRandomString(Length: integer): string; @@ -303,7 +304,7 @@ begin + '+' + IntToStr(Status and DS_SMTPREPLYMASK); end; -procedure AssignDeliveryStatusToSMTPCodes(Envelope: TEnvelope); +procedure AssignDeliveryStatusToSMTPCodes(Envelope: TEnvelope; TransactionComplete: boolean); var i, code, cond, status: integer; Recipient: TRecipient; begin for i:= 0 to Envelope.GetNumberOfRecipients - 1 do begin @@ -312,7 +313,8 @@ begin cond:= code div 100; case cond of 0: status:= DS_DELAYED or DS_UNEXPECTEDFAIL; - 2: status:= DS_DELIVERED; + 2: if TransactionComplete then status:= DS_DELIVERED + else status:= DS_DELAYED or DS_UNEXPECTEDFAIL; 4: status:= DS_DELAYED; 5: status:= DS_PERMANENT; else status:= DS_PERMANENT or DS_UNEXPECTEDFAIL; @@ -658,6 +660,13 @@ begin FRecipients[Index].Data:= Data; end; +procedure TEnvelope.SetAllRecipientData(Data: integer; RMsg: string = ''); +var i: integer; +begin + for i:= 0 to Length(FRecipients) - 1 do + SetRecipientData(i, Data, RMsg); +end; + procedure TEnvelope.SetReturnPath(Address: string); begin FReturnPath:= Address;