-
-
Notifications
You must be signed in to change notification settings - Fork 150
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
How to disable reverse DNS lookup? #230
Comments
@atesca09 Yes I can confirm this problem. There are two issues here:
In the meantime there is nothing I can do here unfortunately. |
@axllent yeah I thought so, I was just checking in, in case I missed something. Unfortunately the workaround specifying a shorter name isn't an option for me in the current setup. I guess we'll have to wait for smtpd to provide the option to skip the reverse DNS lookup |
@atesca09 I will probably submit a pull request to smtpd later today if get around to it. Out of curiosity, are you using Gitlab CI (in relation to it not being an option for you)? |
@axllent No the issue for my use-case isn't in GitLab. Besides the workaround with emptying /etc/resolv.conf is unacceptable for the use-case. It is more a problem with the amount of projects that are affected (~100+) and the amount of changes that have to be made just to replace the old mailhog with mailpit |
@atesca09 This new feature has been released in v1.13.0 and should solve your issue completely. Starting Mailpit with either the version: '3.9'
services:
mailpit:
image: axllent/mailpit
environment:
- MP_SMTP_DISABLE_RDNS=true
ports:
- '8025:8025'
curl:
image: curlimages/curl
volumes:
- ./email.txt:/email.txt:ro
depends_on:
- mailpit time docker compose run --rm curl smtp://mailpit:1025 --mail-from [email protected] --mail-rcpt [email protected] --upload-file /email.txt
[+] Creating 1/0
✔ Container really-long-project-name-for-testing-dns-rdata-mailpit-1 Running 0.0s
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 145 0 0 100 145 0 11276 --:--:-- --:--:-- --:--:-- 12083
real 0m0.878s
user 0m0.057s
sys 0m0.020s Please confirm this resolves your issue? Thanks. |
Confirmed, this works for me. Thanks a lot @axllent |
Mailpit uses smtpd as smtp server
smtpd tries to do a reverse DNS lookup of the IP sending the mail, see https://github.com/mhale/smtpd/blob/cfd012220c479797ab15cee042831c95ea95dd1e/smtpd.go#L244
docker compose generates a domain name based on <contianer_name>-<container_id>.<network_name>
if I run the Mailpit as part of a docker compose project the generated name might get too long and the reverse DNS lookup return bad rdata
dockerd[1528]: level=error msg="[resolver] failed to write response" error="dns: bad rdata"
with that bad rdata the lookup times out after 10 seconds and the sender is resolved as
unknown
But the 10 second timeout is too long for the Symfony 4.4 Mailer which uses a timeout of 5 seconds, see https://github.com/symfony/mailer/blob/554b8c0dc2db9d74e760fd6b726f527364f03302/Transport/Smtp/Stream/SocketStream.php#L29
Even with newer versions of Symfony, waiting 10 seconds for the timeout to occur seems wrong
Steps to reproduce:
Create a directory
really-long-project-name-for-testing-dns-rdata
add a
docker-compose.yaml
with:add a demo
email.txt
send the email with
docker compose run --rm curl smtp://mailpit:1025 --mail-from [email protected] --mail-rcpt [email protected] --upload-file /email.txt
It will send the email with an "unknown" as the hostname of the sending IP, but it'll take 10 seconds which is too long to send emails from a Symfony 4.4 project
The text was updated successfully, but these errors were encountered: