Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

condition.define_envelope_stopper do |context, envelope| #56

Open
falon opened this issue Jan 23, 2015 · 1 comment
Open

condition.define_envelope_stopper do |context, envelope| #56

falon opened this issue Jan 23, 2015 · 1 comment

Comments

@falon
Copy link

falon commented Jan 23, 2015

Hello.
This is not a bug, but a request of a new feature about conditions.

Now milter manager use envelope from OR recipients to apply a condition ("condition.define_envelope_recipient_stopper do |context, recipient|" and "condition.define_envelope_from_stopper do |context, from|").

It should be useful a condition that apply on recipients or from, such as:

condition.define_envelope_stopper do |context, envelope|

where "envelope" is the joint of mail from and rcpt to addresses.

This could be useful in milters where the application depends on recipients or sender without difference.
Thank you very much

@kou
Copy link
Member

kou commented Feb 10, 2015

Thanks for your suggestion!

Your define_envelope_stopper like feature can be implemented by the following define_data_stopper:

define_applicable_condition("envelope-stopper") do |condition|
  condition.define_envelope_from_stopper do |context, from|
    context.mail_transaction_shelf["from"] = from
    context.mail_transaction_shelf["recipients"] = []
    false
  end

  condition.define_envelope_recipient_stopper do |context, recipient|
    context.mail_transaction_shelf["recipients"] += [recipient]
    false
  end

  condition.define_data_stopper do |context|
    p context.mail_transaction_shelf["from"] # => MAIL FROM address
    p context.mail_transaction_shelf["recipients"] # => RCPT TO addresses
    false
  end
end

Saving MAIL FROM and RCPT TO addresses all time will decrease performance a bit. So I don't want to enable it by default...

And if a child milter skips MAIL FROM and/or RCPT TO events, we can't provide the feature. It may confuse users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants