- Download Mailhog from Github releases
- Copy and rename the downloaded file to
C:\wamp64\bin\mailhog.exe
Edit following files :
C:\wamp64\bin\apache\apache[VERSION]\bin\php.ini
(which is shortcut toC:\wamp64\bin\php\php[VERSION]\phpForApache.ini
)C:\wamp64\bin\php\php[VERSION]\php.ini
And change following lines :
-smtp_port = 25
+smtp_port = 1025
Then :
- Restart Apache
- Run mailhog.exe
- Visit http://localhost:8025/ in your browser
Put this script in a file test-mail.php
:
<?php
$to = '[email protected]';
$subject = 'Hello from WampServer!';
$message = 'This is a Mailhog test';
$headers = "From: [email protected]\r\n";
if (mail($to, $subject, $message, $headers)) {
echo "SUCCESS";
} else {
echo "ERROR";
}
Then run it with php test-mail.php
Mail will be shown in your browser.
Edit .env
file :
MAIL_MAILER=smtp
MAIL_HOST=localhost
MAIL_PORT=1025
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=null