reacherhq / check-if-email-exists

Check if an email address exists without sending any email, written in Rust. Comes with a ⚙️ HTTP backend.
https://reacher.email
Other
4.29k stars 328 forks source link

RCH_SMTP_TIMEOUT / smtp_timeout not respected? #1320

Closed tchwpkgorg closed 9 months ago

tchwpkgorg commented 1 year ago

Email Provider

WHM / Exim

Version of check-if-email-exists (if running it yourself)

0.4.0

What happened?

I have an Exim server (WHM) which responds to SMTP commands after 20-30 seconds:

# telnet 10.11.12.13 25
Trying 10.11.12.13...
Connected to 10.11.12.13.
Escape character is '^]'.

<----- here, this SMTP server waits for 20-30 secs before it replies ----->

220-test-server ESMTP Exim 4.96 #2 Fri, 02 Jun 2023 22:46:26 +0100 
220-We do not authorize the use of this system to transport unsolicited, 
220 and/or bulk e-mail.

reacher_backend gives up earlier, after around 15 seconds - and marks email addresses as "unknown".

I've tried setting RCH_SMTP_TIMEOUT / smtp_timeout variables to 60, but reacher_backens seems to ignore it and still gives up after ~15 secs.

Relevant log output

No response

mrbrown444 commented 1 year ago

Pls can I use this smtp to send bulk Email?

amaury1093 commented 11 months ago

I removed RCH_SMTP_TIMEOUT some time ago. After a lot of testing, I think it doesn't make sense to set a global RCH_SMTP_TIMEOUT across the whole backend, because each mail server (like yours) can have custom waiting times to fight spam.

So the better solution is a timeout per domain (or per MX record). In #1348 I put this info in rules.json: https://github.com/reacherhq/check-if-email-exists/blob/fda33a27441e2ccb1c4e97c0fc582abf25b1561f/core/src/rules.json#L11-L13

Obviously, it'll take time to populate that JSON. The interim solution is an input.smtp_timeout per request, defaults to 12s, which the user can override:

{
  "to_email": "me@longmailserver.com",
  "smtp_timeout": {"seconds": 45, "nanos": 0}
}
amaury1093 commented 9 months ago

Opening again. Some other people are also asking for this, so I'll put it back.