LinusU / server-accepts-email

Check if an SMTP server accepts emails to a given address
39 stars 9 forks source link

Authenticated SMTP to Prevent Blacklisting #26

Open Dragon-God opened 2 years ago

Dragon-God commented 2 years ago

When running the application with a few thousand emails from within an Azure environment, it was quickly blacklisted.

After some investigation, it seems that SMTP requests over port 25 are fraught with spam and are used by botnets. The application's behaviour was flagged as such.

I also discovered that one of the outbound IP addresses the Azure app was using was listed on Spamhaus' list. Spamhaus recommends that email clients use port 587 instead of port 25.

Is it possible to configure the application to send SMTP requests over port 587 instead of port 25. If so, how would I go about this?

LinusU commented 2 years ago

https://www.mailgun.com/blog/which-smtp-port-understanding-ports-25-465-587/

Hmm, yeah, we should probably default to port 587 and fallback to port 25 only if that doesn't work...

Should be quite easy to implement...

https://github.com/LinusU/server-accepts-email/blob/master/src/socket.ts

Dragon-God commented 2 years ago

https://www.mailgun.com/blog/which-smtp-port-understanding-ports-25-465-587/

Hmm, yeah, we should probably default to port 587 and fallback to port 25 only if that doesn't work...

Should be quite easy to implement...

https://github.com/LinusU/server-accepts-email/blob/master/src/socket.ts

Will changing line 65 from:

this.socket = net.connect(25, server)

To:

this.socket = net.connect(587, server)

Be sufficient? Or will extra code be required to make the connection over SSL?

Also, what error/message should be checked for to determine if the request needs to be tried again with port 25.

alexhammerschmied commented 1 year ago

Hi guys, just wondering, are you still working on this? Did you figure out how to do the sending via port 587? I guess to use TLS we need to add some kind of secure layer to the server?