Giter Club home page Giter Club logo

Comments (7)

emersion avatar emersion commented on May 15, 2024

Start pipeline before the body is received

+1

Requires changes to go-smtp (pre-body callback for DATA command)

That's not true, the DATA handler is called before the body has been received (directly after receiving the DATA command). and is given an io.Reader that directly reads from the underlying net.Conn.

It is not possible to report errors for individual recipients or even MAIL FROM command.

Hmm. Indeed, that's an issue.

from maddy.

foxcpp avatar foxcpp commented on May 15, 2024

That's not true, the DATA handler is called before the body has been received (directly after receiving the DATA command). and is given an io.Reader that directly reads from the underlying net.Conn.

https://github.com/emersion/go-smtp/blob/930d6dfbf447707ddcc38bbafccd8d1596cc6181/conn.go#L435

From my initial post:

Also, SMTP doesn't allow us to "abort" transaction once we sent 354 intermediate reply to the DATA command.

So at the time DATA handler gets called, we have to consume the body sent by the client, what I want to avoid:

We want to run certain checks (#41) on the envelope before the message body is sent to us to not waste traffic

from maddy.

emersion avatar emersion commented on May 15, 2024

Oh, I see. You're right.

from maddy.

foxcpp avatar foxcpp commented on May 15, 2024

Still no ideas other/better than n. 1. Though interfaces may be split into three (EHLO/MAIL FROM/RCPT TO checks). Probably we should just go with it, wdyt?

from maddy.

foxcpp avatar foxcpp commented on May 15, 2024

Another (relatively) small change to envelope checks is to hide them behind regular filter directive.
If you, say, write filter check_source_hostname, it will actually add a check to the EHLO command.
But there are several problems with this "attempt to hide complexity": Envelope checks are executed in a different order. Say, with filter check_source_mx and then filter check_source_mx user could expect that the checks will run in that order, but in fact, they will be executed in reverse because first "filter" checks RCPT and second checks EHLO. So I proposed to add explicit groups of checks. The same approach used by postifx and it is actually recommended by RFC 5321 (the allowed way is to accept all messages and then send bounce messages if something is wrong, but it creates more problems on its own).

from maddy.

foxcpp avatar foxcpp commented on May 15, 2024

Alright, a decision is needed on this one.

We are going with a modified version of the first solution.

type EhloFilter interface {
  Ehlo(ehlo string) error
}
type FromFilter interface {
  From(to string) (string, error)
}
type RcptFilter interface {
  Rcpt(to string) (string, error)
}
smtp ... {
  ehlo {
    check_source_hostname
    check_source_rdns
  }
  rcpt {
    check_source_mx
  }
}

from maddy.

foxcpp avatar foxcpp commented on May 15, 2024

Closing in favor of the design change proposed in #101.

from maddy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.