Pathros
Pathros

Reputation: 10750

Laravel Homestead Mailhog Error listening on socket: listen tcp 0.0.0.0:1025: bind: address already in use

I am struggling to make MailHog work in my Laravel Homestead VM.

If I browse http://localhost:8025/, the web browser says it can't find it.

Then, in the command line, when executing $ mailhog, I get the following error:

Error listening on socket: listen tcp 0.0.0.0:1025: bind: address already in use

Moreover, if I execute $ mailhog --invite-jim then I get:

2021/09/13 22:49:22 Using in-memory storage 2021/09/13 22:49:22 [SMTP] Binding to address: 0.0.0.0:1025 [HTTP] Binding to address: 0.0.0.0:8025 2021/09/13 22:49:22 Serving under http://0.0.0.0:8025/ 2021/09/13 22:49:22 [SMTP] Error listening on socket: listen tcp 0.0.0.0:1025: bind: address already in use

Here is my .env config file

.env

MAIL_MAILER=smtp
MAIL_HOST=localhost
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
[email protected]
MAIL_FROM_NAME="${APP_NAME}"

Does anyone know or can shed some light how to make MailHog work?

Upvotes: 1

Views: 2263

Answers (1)

Pathros
Pathros

Reputation: 10750

Mailhog web interface is clearly listening at the 8025 port. The localhost or 127.0.0.1 address may not work by default.

Take a look at both the /etc/hosts and Homestead.yml file

$ sudo vim /etc/hosts
$ vim Homestead.yml

Look for the address that Homestead is working on. In this case it's 192.168.10.10 or 192.168.56.56

So now try http://192.168.10.10:8025 or http://192.168.56.56:8025

And it should be working now

Upvotes: 1

Related Questions