We introduced mailhog to test mail transmission with Ravel, which is operated by docker.
However, an error has occurred and cannot be sent.
Swift_TransportException
Connection could not be established with host mailhog:stream_socket_client():php_network_getaddresses:getaddrinfo for mailhog failed:Temporary failure in name resolution
operating environment:
php 8.1.8
Ravel Framework 8.83.23
sail 8.1
For maihog deployment, we performed the following steps:
1) docker-compose.yml
mail:
image:mailhog/mailhog
container_name —mailhog
ports:
- "1025:1025"
- "8025:8025"
2) .env
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
// Add
WWWGROUP = 1000
WWWUSER = 1000
3) Update docker-image
docker-compose build--no-cache
4) Launch sail
sailup-d
5) Inbox confirmation for mailhog
http://localhost:8025
Display successfully
6) Send mail=>Error
7) Attempted to change settings for error.
The same error occurs when MAIL_HOST
in .env is mail
localhost
My hands are completely clogged.
Where else should I check?
mail:
image:mailhog/mailhog
container_name —mailhog
ports:
- "1025:1025"
- "8025:8025"
networks:
- sail
As mentioned above, it was resolved by adding networks at the end.
Build with docker-compose build --no-cache
after adding
© 2024 OneMinuteCode. All rights reserved.