From e83f5654d8d1a012347bd37858c3263e2149dc8b Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Mon, 13 Nov 2017 12:29:16 +0100 Subject: [PATCH 1/2] Updated NOTIFICATION_SMTP_MAILER to follow the EiffelNet EMAIL design. --- .../smtp/notification_smtp_mailer.e | 88 ++++++++++++------- 1 file changed, 57 insertions(+), 31 deletions(-) diff --git a/library/runtime/process/notification_email/smtp/notification_smtp_mailer.e b/library/runtime/process/notification_email/smtp/notification_smtp_mailer.e index 3400dcab..b2597cad 100644 --- a/library/runtime/process/notification_email/smtp/notification_smtp_mailer.e +++ b/library/runtime/process/notification_email/smtp/notification_smtp_mailer.e @@ -95,40 +95,67 @@ feature -- Basic operation l_email: EMAIL h: STRING i: INTEGER + lst: LIST [READABLE_STRING_8] do - create l_email.make_with_entry (a_email.from_address, addresses_to_header_line_value (a_email.to_addresses)) - if attached a_email.reply_to_address as l_reply_to then - l_email.add_header_entry ({EMAIL_CONSTANTS}.h_reply_to, l_reply_to) - end - - if attached a_email.cc_addresses as lst then - l_email.add_header_entry ({EMAIL_CONSTANTS}.h_cc, addresses_to_header_line_value (lst)) - end - if attached a_email.bcc_addresses as lst then - l_email.add_header_entry ({EMAIL_CONSTANTS}.h_bcc, addresses_to_header_line_value (lst)) - end - l_email.set_message (a_email.content) - l_email.add_header_entry ({EMAIL_CONSTANTS}.H_subject, a_email.subject) - - create h.make_empty - ;(create {HTTP_DATE}.make_from_date_time (a_email.date)).append_to_rfc1123_string (h) - l_email.add_header_entry ("Date", h) - - if attached a_email.additional_header_lines as lst then - across - lst as ic - loop - h := ic.item - i := h.index_of (':', 1) - if i > 0 then - l_email.add_header_entry (h.head (i - 1), h.substring (i + 1, h.count)) - else - check is_header_line: False end + lst := a_email.to_addresses + if lst.is_empty then + -- Error ... + else + -- With EMAIL, there should be a unique recipient at creation. + create l_email.make_with_entry (a_email.from_address, lst.first) + if lst.count > 1 then + from + lst.start + lst.forth + until + lst.off + loop + l_email.add_recipient_address (lst.item) + lst.forth end end - end + if attached a_email.reply_to_address as l_reply_to then + l_email.add_header_entry ({EMAIL_CONSTANTS}.h_reply_to, l_reply_to) + end - smtp_send_email (l_email) + if attached a_email.cc_addresses as l_cc_addresses then + across + l_cc_addresses as ic + loop + l_email.add_recipient_address_in_cc (ic.item) + end + end + if attached a_email.bcc_addresses as l_bcc_addresses then + across + l_bcc_addresses as ic + loop + l_email.add_recipient_address_in_bcc (ic.item) + end + end + l_email.set_message (a_email.content) + l_email.add_header_entry ({EMAIL_CONSTANTS}.H_subject, a_email.subject) + + create h.make_empty + ;(create {HTTP_DATE}.make_from_date_time (a_email.date)).append_to_rfc1123_string (h) + l_email.add_header_entry ("Date", h) + + if attached a_email.additional_header_lines as l_lines then + across + l_lines as ic + loop + h := ic.item + i := h.index_of (':', 1) + if i > 0 then + l_email.add_header_entry (h.head (i - 1), h.substring (i + 1, h.count)) + else + check is_header_line: False end + end + end + end + + smtp_send_email (l_email) + + end end feature {NONE} -- Implementation @@ -182,4 +209,3 @@ note Customer support http://support.eiffel.com ]" end - From 5fedad7f2e2d742721e3d63cd1670575cbf88db3 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Mon, 13 Nov 2017 12:31:19 +0100 Subject: [PATCH 2/2] Updated Changelog. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f72a22f..378a172f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). - `http_client`: Added support for multiple file in form data. Made clear what is the meaning of `upload_filename`, `upload_data` and `form_data`. - `authentication`: HTTP_AUTHORIZATION acceps now READABLE_STRING_GENERAL for username and password argument. - `http_client`: fixed curl implementation by setting `Content-Type` to `x-www-form-urlencoded` (if not set) when POST send data as `x-www-form-urlencoded`. +- `notification_email`: fixed the SMTP support for multiple recipients address. ### Security