Improved NOTIFICATION_SMTP_MAILER.make (..) to support user:password@...

Propage error in notification_chain_mailer.
This commit is contained in:
2017-03-07 13:14:16 +01:00
parent 5988d9d74b
commit f2ecccce4f
2 changed files with 29 additions and 1 deletions

View File

@@ -50,9 +50,24 @@ feature -- Basic operation
do
if active.is_available then
active.process_email (a_email)
import_errors (active)
end
if attached next as l_next and then l_next.is_available then
l_next.process_email (a_email)
import_errors (l_next)
end
end
feature {NONE} -- Errors
import_errors (a_mailer: NOTIFICATION_MAILER)
do
if attached a_mailer.last_errors as errs then
across
errs as ic
loop
report_error (ic.item)
end
end
end

View File

@@ -21,8 +21,21 @@ create
feature {NONE} -- Initialization
make (a_smtp_server: READABLE_STRING_8)
-- Create with smtp setting `user:password@hostname:port".
local
p,q: INTEGER
do
make_with_user (a_smtp_server, Void, Void)
p := a_smtp_server.index_of ('@', 1)
if p > 0 then
q := a_smtp_server.index_of (':', 1)
if q < p then
make_with_user (a_smtp_server.substring (p + 1, a_smtp_server.count), a_smtp_server.substring (1, q -1), a_smtp_server.substring (q + 1, p -1))
else
make_with_user (a_smtp_server.substring (p + 1, a_smtp_server.count), a_smtp_server.substring (1, p -1), Void)
end
else
make_with_user (a_smtp_server, Void, Void)
end
end
make_with_user (a_smtp_server: READABLE_STRING_8; a_user: detachable READABLE_STRING_8; a_password: detachable READABLE_STRING_8)