Skip to content

Commit e046c13

Browse files
committed
Adjusted new messages
1 parent 47c09aa commit e046c13

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

src/SendEmail.pas

+23-5
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ constructor TSendEmail.Create;
142142
OnWork := Work;
143143
OnWorkEnd := WorkEnd;
144144
ManagedIOHandler := True;
145+
PipeLine := False;
145146
end;
146147

147148
with FIdSSLOpenSSL do
@@ -570,7 +571,7 @@ function TSendEmail.Connect: TSendEmail;
570571
except
571572
on E: Exception do
572573
begin
573-
Log(E.Message, True);
574+
Log('Except: ' + E.Message, True);
574575
Log('Email not connected!');
575576
raise;
576577
end;
@@ -598,9 +599,10 @@ function TSendEmail.Send(const ADisconnectAfterSending: Boolean = True): TSendEm
598599
except
599600
on E: Exception do
600601
begin
601-
Log(E.Message, True);
602+
Log('Except: ' + E.Message, True);
602603

603-
if E.Message.ToUpper.Contains('CLOSING CONNECTION') or
604+
if
605+
E.Message.ToUpper.Contains('CLOSING CONNECTION') or
604606
E.Message.ToUpper.Contains('TOO MANY MESSAGES')
605607
then
606608
begin
@@ -621,6 +623,22 @@ function TSendEmail.Send(const ADisconnectAfterSending: Boolean = True): TSendEm
621623
if E.Message.ToUpper.Contains('NOT CONNECTED') then
622624
raise Exception.Create('Not connected to internet!');
623625

626+
if
627+
E.Message.ToUpper.Contains('NO SUCH USER HERE') or
628+
E.Message.ToUpper.Contains('USER UNKNOWN') or
629+
E.Message.ToUpper.Contains('MAILBOX UNAVAILABLE')
630+
then
631+
raise Exception.Create('The recipient''s mailbox does not exist in the destination domain. It was probably typed incorrectly!');
632+
633+
if
634+
E.Message.ToUpper.Contains('MAILBOX IS FULL') or
635+
E.Message.ToUpper.Contains('MAIL QUOTA EXCEEDED') or
636+
E.Message.ToUpper.Contains('MAILBOX FULL') or
637+
E.Message.ToUpper.Contains('DISK QUOTA EXCEEDED') or
638+
E.Message.ToUpper.Contains('USER IS OVER THE QUOTA')
639+
then
640+
raise Exception.Create('It means that the recipient''s inbox is full and cannot receive any more messages!');
641+
624642
raise Exception.Create(E.Message);
625643
end;
626644
end;
@@ -672,7 +690,7 @@ function TSendEmail.Disconnect: TSendEmail;
672690
FIdSMTP.Disconnect(False);
673691
Log('Disconnected');
674692
except
675-
Log('Disconnected with error');
693+
Log('Except: Disconnected with error');
676694
end;
677695

678696
if FSSL or FTLS then
@@ -796,4 +814,4 @@ finalization
796814

797815
FreeAndNil(TSendEmail.RW);
798816

799-
end.
817+
end.

0 commit comments

Comments
 (0)