mailin icon indicating copy to clipboard operation
mailin copied to clipboard

Can't configure network interface to listen on

Open toomim opened this issue 10 years ago • 10 comments

I followed the instructions to set up mailin, and I can get it to listen on localhost:

$ telnet localhost 25
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 localhost ESMTP Mailin Smtp Server

But it isn't listening on my actual public IP:

$ telnet 54.97.96.117 25
Trying 54.97.96.117...
telnet: Unable to connect to remote host: Connection refused

Perhaps I configured it wrong. But I've also noticed that my server is perhaps configured to think that is name is localhost:

$ echo $HOSTNAME
localhost

Is there something to do to fix my server config? Can't I just tell mailin "Hey, listen on interface eth0!"?

toomim avatar Dec 28 '15 09:12 toomim

I suspect it to be due to some network configuration issue rather than to mailin. Is your machine behind any router? To be sure it holds this public IP, can you post the output of ifconfig?

Le 28 décembre 2015 10:15:04 UTC+01:00, Michael Toomim [email protected] a écrit :

I followed the instructions to set up mailin, and I can get it to listen on localhost:

$ telnet localhost 25
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 localhost ESMTP Mailin Smtp Server

But it isn't listening on my actual public IP:

$ telnet 54.97.96.117 25
Trying 54.97.96.117...
telnet: Unable to connect to remote host: Connection refused

Perhaps I configured it wrong. But I've also noticed that my server is perhaps configured to think that is name is localhost:

$ echo $HOSTNAME
localhost

Is there something to do to fix my server config? Can't I just tell mailin "Hey, listen on interface eth0!"?


Reply to this email directly or view it on GitHub: https://github.com/Flolagale/mailin/issues/75

2franix avatar Dec 28 '15 16:12 2franix

Thanks, but there was no problem in the network. The problem was, in fact, that mailin was listening on the wrong interface.

I fixed this by looking at the source code, finding where mailin tells smtp-server which network interface to listen on, and seeing that you can configure this with the host parameter in:

mailin.start({
   host: "54.97.96.117",
   port: 25,
   // etc...
})

This host parameter should go in the documentation.

toomim avatar Dec 28 '15 19:12 toomim

The same problem. Mailin starts on the local interface, instead external.

pomeo avatar Dec 29 '15 15:12 pomeo

@pomeo, did you read the fix?

On Dec 29, 2015, at 7:07 AM, Sergey Ovechkin [email protected] wrote:

The same problem. Mailin starts on the local interface, instead external.

— Reply to this email directly or view it on GitHub.

toomim avatar Dec 29 '15 17:12 toomim

@toomim Yes. Only from the command line it doesn't work. Because there is no --host. Not from the command line of course works with "host:"

pomeo avatar Dec 29 '15 18:12 pomeo

+1 Had trouble with this after updating to the latest release also, as it is an undocumented change and also breaks the example in the readme. Used to work without any configuration.

tomforster avatar Dec 29 '15 18:12 tomforster

+1 same here, I'm using it from the command line and it's binding the 127.0.0.1 ip I can't get it to bind the 0.0.0.0 from the command line so until a fix is release to add a --host The only solution I see is to embed mailin into an small app to be able to configure the host like @toomim did...

gpapin avatar Jan 18 '16 16:01 gpapin

Created a pull request which should restore the functionality of the previous version, while allowing the host configuration to be set if required. This also adds the functionality to the cli.

tomforster avatar Jan 24 '16 15:01 tomforster

@janbialostok, it looks like it was a host issue (in relation to #77 )

yawetse avatar Jan 24 '16 15:01 yawetse

@tomforster provided a fix by allowing the host configuration to be set from the command line. It is published as [email protected].

Flolagale avatar Jan 25 '16 11:01 Flolagale