Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: create bounce email logic for a single email mail service. Remaining: ITs, multiple email * feat: refactor, move everything to commons * feat: fix tests * feat: use javasender impl instead a custom one * feat: store already existing message id listener and event listener * feat: rename method * feat: add TODO when we need to move the bouncing detector * Renamed "e_mail" column to "email" to be consistent with other tables * Added TODOs * Renamed `bounced_email_address` to `undeliverable_email` to better describe its function (i.e. a mail *message* will bounce, and the undeliverable email address will be stored in this table) * Renamed `in_progress_mail` to `in_progress_message` to distinguish outgoing mail message from email address ("mail" is ambiguous) * Fix comment syntax in SQL files * Don't use camel casing for database column names * Fix SQL * feat: add new database call form repository for whois-internal endpoint * Replace previous Mail integration test class with one that mocks the mail sender * feat: fix unit tests * Don't use a JavaMail Listener to detect send failures, instead set envelope reply and handle in MessageDequeue * Don't use a JavaMail Listener to detect send failures * Tests * Generate failure notification message and put it in the mail queue * Added TODO * Added example emails for delayed delivery and permanent failure * The failure reply message-id has a different Message-Id than the outgoing message, and we need to find it * Updated tests * Add Nullable * Add Nullable * Remember to enable DSN * feat: do not use bounced, use undeliverable for naming * feat: rename table, createMessageId before sending, rollback MailSenderBase * Test that delayed response message doesn't set email address to undeliverable * Add tests for unsubscribed email address * do send notification to deliverable address * feat: create the bounce detector * feat: add normalise for emails and fix Unit Tests * feat: change mail gateway to avoid sending bounced emails * feat: rename static method, use outcomming email instead message email for undeliverable * feat: tests bounced are detected * feat: get the uuid for the messageId in another way * feat: add a configurable envelope from header * feat: add ITs * feat: use mail.smtp.from to specify the envelope from address * feat: improve full_email_address_is_normalised test * Generate UUID in MariaDB server * Don't create another MailGatewaySmtp instance in test method with Stub class, instead use the same subject and test the argument. * Separate Daos for separate tables * Don't throw an exception if it's expected (i.e. EmptyResultDataAccessException) as it's slow, instead detect whether there are any results. * Create an index for outgoing_message.email as we're querying for it. * mimeMessage getHeader() can return null; don't depend on order of report header parts * Moved bounced message parsing into whois-api beside MessageParser * Removed duplicate dependency * Use try-with-resources * Fixed tests * Simplified parsing code * Added mailupdatesTemplate to tests for readability * Use internalsTemplate in tests * Only parse bounces if mail.smtp.from property is set. * Removed TODO. MessageId is never null in BouncedMessage. * Don't try to send mail * Mail sending is enabled by default * Set message-id in mail headers properly (i.e. generate without angle-brackets and then add angle brackets in headers) * feat: create a separate service to handle bouncing logic and tests * Fixed permanent failure test messages (the recipient is supposed to be *Whois*, i.e. the bounce is returned back to the sender, which is Whois) * feat: fix unit tests * feat: fix tests and inverse the bouncer if * feat: add properties into Mail configuration * feat: remove unused autorwire * feat: create an abstract class for ITs * feat: set default dns.notify and dsn.ret * feat: point to RC * feat: retrieve automatically all the mail.smtp properties * feat: add some logs, undo auto properties matcher and point to PROD after testing * feat: move the properties to xml properties and leave MailCOnfiguration as before * feat: log content class type * feat: change the instanceOf to check MimeMultipart instead MultipartReport * feat: tackle when the type is MimeMultipart * feat: delete message from mail updates if it is a bounced message * feat: return null in case information is not there * feat: set mail.smtp.enabled to false by default * feat: use a new test using real mail information * feat: add mail app property * feat: add the property as a global property * feat: if messageId exists use that instead * feat: message id header case sensitive, putting D in uppercase * feat: remove previous logic * feat: fix compilation issue * feat: use a previous message Id if that message Id is already set * feat: use a custom messageId * feat: use customMimeMessage in ut as well * Initialise Jakarta Mail DSN properly * Don't try to create a message-id but instead copy whatever is generated *after* the message is sent. * feat: fix tests * feat: send a comment explaining that the messageId is in address format * feat: improve UT * feat: create customJavaMailSender * feat: add the custom java sender impl into the context * feat: fix tests * feat: PR requested changes and improvements * feat: rename method * web.baseurl is a mandatory property * Move *all* mail configuration to MailConfiguration component * Remove unused property * Only set Unsubscribe headers if we're reading replies. Add mailto unsubscribe. Added example unsubscribe replies. * Fixed String.format * handle unsubscribe messages * Fixed tests * Add logging * Enable outgoing mail (to stub) for tests * feat: PR comments, merge both service into one * Log all exceptions when sending mail in console log (not just in audit log). * Test that undeliverable response message is deleted * feat: solve conflict with origin branch * feat: change abstract class name, it is not just bounced * feat: change a log, it is not logging unsubscribe * feat: rename dao methods * feat: use the dao instead a method in the middle to perform the call in the service * Merge mailcap files together (Jakarta Mail, DSN, Bouncy Castle) * feat: store enum string, not enum object * Log *any* possible exceptions from MessageDequeue. * Remove unnecessary TODO * Mocked methods return null by default * Align schema changes * Add /api/ to db-web-ui unsubscribe URL * feat: add business rule for warn the user if mail is not deliverable or is unsubscribed * Check base web URL ending (don't construct a URL with a double forward slash as it'll produce a 400 bad Request "Ambiguous URI empty segment" from Jetty)/ * feat: use IN for getting all the results as one * use update Notifier class only as context is available till then * fix test * Revert "fix test" This reverts commit 359a3ca. * Revert "use update Notifier class only as context is available till then" This reverts commit 03f4c81. * refactor * feat: fix tests --------- Co-authored-by: Ed Shryane <eshryane@ripe.net> Co-authored-by: Mahesh Aggarwal <maggarwal@ripe.net>
- Loading branch information