Files
kumomta/docs/reference/events/smtp_server_connection_accepted.md
T
Wez Furlong 42bf5c5e61 docs: adjust reference to improve search terms
We've been hoping that mkdocs-material will ship the much anticipated
search enhancements for some time, but it's time to recognize that
we need to do something to improve the search results with how
things work right now.

This is a big commit that changes the titles of the various pages
from the code-annotated synopsis to just the name of the function.

This makes it much easier now to match things like `kumo.reject`
directly, but `reject` remains awkward to find.

I think this is the best that we can do at this time.

A few functions have been annotated with the `status: deprecated` to
show as deprecated in the toc/nav (shows with a little trash can next
to the name).
2025-05-16 14:02:19 -07:00

1.1 KiB

smtp_server_connection_accepted

kumo.on('smtp_server_connection_accepted', function(conn_meta) end)

{{since('2025.05.06-b29689af')}}

Called by the ESMTP server when a new server session has accepted a connection from a client.

This event is triggered before sending the initial banner response, giving you the opportunity to decide whether to reject the connection, or continue.

If you do not reject the connection, then the server will continue with returning the banner to the client as normal.

The Connection Metadata object is passed as the only parameter, which can be used to determine information about the peer, and can be modified to track additional context throughout the lifetime of this particular connection.

kumo.on('smtp_server_connection_accepted', function(conn_meta)
  local peer = conn_meta:get_meta 'received_from'
  -- is_peer_deny_listed is some hypothetical function you
  -- define that will check to see if you want to allow this
  -- connection to continue
  if is_peer_deny_listed(peer) then
    kumo.reject(421, string.format('service not accepted from %s', peer))
  end
end)