smtp4dev icon indicating copy to clipboard operation
smtp4dev copied to clipboard

Add Custom Reply code on mailbox

Open zakazchick opened this issue 8 months ago • 1 comments

Thanks for a great tool, but it should definitely be supplemented with functionality that allows you to change the server response at the right stage. Example - on the DATA command, you can output “550 5.7.1 You are blocked”. Or after QUIT, if the field is not filled - give 250, if it is filled - the code specified in the field. Setting is done for each mail separately in the window of mail creation. This would be an ideal tool to test routing rules and anti-spam system.

zakazchick avatar Apr 17 '25 09:04 zakazchick

@zakazchick There is already a simple expression driven facility for this. See appsettings.json and look for RecipientValidationExpression and MessageValidationExpression.

I am open to:

  1. extending this to cover other verbs or even every request that is sent by the client.
  2. extending the visibility of this into to settings dialog in the UI with a decent editor that exposes the properties and functions that are available (or even visual rule builder UI to edit the rules)
  3. linking rules to specific users or mailboxes to ease use of this in a multi-user scenario (automatically scoped to run only if sending user or receiving mailbox matches.
  4. more functions - see the top of the settings file for what is currently available.

Let me know what you think once you've tried what is already available.

rnwood avatar Apr 26 '25 10:04 rnwood