Comments (7)
Just trying to understand here - is there a case where you would want to return a different response to the EHLO and still succeed?
I know personally I haven't had a need for that, but I'm not sure what the valid use cases are.
from aiosmtpd.
I just did some searching and I haven't been able to find a really great reason that EHLO should be returning anything besides a 250.
The only reason I can think of that you might be returning something different is that you've got some kind of broken setup - which indicates that you need to fix your code, not that there's an issue here.
But if there's some case that I have considered, I'd love to hear about it!
from aiosmtpd.
Hi @waynew ! I do have an example :)
When the server connects to the SMTP daemon, the HELO
/EHLO
command can allow many checks that can lead to refusal:
- checking if the IP has a PTR record
- checking that the hostname matches the PTR of that the SPF records allow the IP to send emails
- Checking that the sending IP is not on a blacklist (Spamhaus for instance)
If one of those checks fails, you can return a 4xx/5xx to refuse the connection, before going further.
But with the EHLO
command, aiosmtpd has already returned 250-*
messages before sending that 4xx/5xx code, so it's not good.
Hope that makes sense :)
from aiosmtpd.
Hey @cnicodeme yeah, thanks! That definitely makes sense. Do you have any ideas about how we would want to change this? Pull requests of course are always welcome :)
from aiosmtpd.
I've sent a PR (#157). Let me know what you think.
The PR also kind of join the idea of having None
returned for the hooks instead of MISSING
. (see #154 )
from aiosmtpd.
If there is no way to override the 250 response, how can I test that my SMTP client can fall back to HELO
when EHLO
fails?
from aiosmtpd.
Answering my own question, overriding smtp_EHLO()
is the only way.
from aiosmtpd.
Related Issues (20)
- aiosmptd is treating Bcc as a TO field HOT 5
- Replace flake8 test with ruff HOT 3
- Controller.start() is missing type annotation
- Provide a way to start smtp server on random free port
- [Question] EHLO response in a single packet?
- Example authenticated replayer is not working; Solved
- Let's put `aiosmtpd` under the `aio-libs` org on PyPI HOT 5
- [good first issue] Fix the Read The Docs config file HOT 1
- Some tests in aiosmtpd/tests/test_server.py hang with python 3.12
- assert_smtp_socket fails with Python 3.13.0a3 HOT 1
- custom `handle_HELO` and `handle_EHLO`: 503 Error: send HELO first HOT 1
- 1.4.5: test suite and documentation source is part of the installed resources HOT 2
- Not found code using 'attrs' but it is required. HOT 3
- handle_DATA not called with Proxy Protocol HOT 1
- Old authenticators won't work
- Unable to connect to aiosmtpd server using TLS v1.1 ?
- 1.4.6: pytest fails because test suite uses deprecated `pkg_resources
- 1.4.6: sphinx warnings `reference target not found`
- 1.4.6: please move aiosmtpd/docs and aiosmtpd/tests to project root, and pep517 build warnings
- examples/authenticated_relayer/server.py uses a random salt value
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aiosmtpd.