ChangemakerStudios / Papercut-SMTP

Papercut SMTP -- The Simple Desktop Email Server
2.84k stars 267 forks source link

SMTP Binding Port configurable via Environment variable #254

Closed Aladdin-97 closed 1 month ago

Aladdin-97 commented 11 months ago

Is your feature request related to a problem? Please describe. Running on K8s/Openshift port 25 is reserved and can't be used, causing this issue:

[18:35:33 INF] Starting Server Smtp
[18:35:33 ERR] Unable to Create SMTP Server Listener on Any:25. After 5 Retries. Failing
System.Net.Sockets.SocketException (0x80004005): Permission denied
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at Papercut.Network.Smtp.Server.CreateListener() in /home/travis/build/jijiechen/Papercut/src/Papercut.Network/Smtp/Server.cs:line 163
   at Papercut.Network.Smtp.Server.Start() in /home/travis/build/jijiechen/Papercut/src/Papercut.Network/Smtp/Server.cs:line 235
   at Papercut.Network.Smtp.ServerExtensions.<>c__DisplayClass0_0.<BindObservable>b__0(IObserver`1 o) in /home/travis/build/jijiechen/Papercut/src/Papercut.Network/Smtp/ServerExtensions.cs:line 47

Describe the solution you'd like It would be great to set the port to bind in order to avoid this issue also on k8s platform

Describe alternatives you've considered I thought i could change by replacing on runtime but they are all binary file, which isn't possibile.

Thanks for your consideration and time. Best Regards

Jaben commented 1 month ago

I'm moving the configuration to Microsoft.Configuration for the next release which does support environmental variables. If you want to download and build the server in dev it already supports this -- otherwise you can wait till I get time to make a new release.