jeffreykemp/mailgun-plsql-api

Recipient whitelist

Closed this issue · 2 comments

Implement a whitelist mechanism - e.g. validate email recipient domain against a whitelist of domains.

When a recipient fails the whitelist, allow one of the following to happen:

  • silently drop the email;
  • raise an exception;
  • change the domain to a preferred domain; OR
  • change the recipient to a single address.

Also, allow a separate whitelist for the sending email domain. e.g. "if sender is not anything@example.com, change the sender email address to postmaster@example.com".

init (p_required_sender_domain => 'example.com')

If sender address is not in the domain indicated by required_sender_domain, replace the sender with the default sender email address.

init
  (p_recipient_whitelist => '%@example.com,exactemail@example.com.au'
  ,p_whitelist_action => suppress | raise_exception | '%@example.com' | 'me@example.com'
  );

If the whitelist setting is set, check each recipient (to/cc/bcc).
If any recipient doesn't match one of the whitelist entries, take action as per whitelist_action.

  • suppress: don't send the email, log silently
  • raise_exception: raise an exception to the caller
  • change the recipient domain to the specified domain
  • change the recipient to the specified email address