I’ve set up mailhog for testing on my localhost which works when adding this to a page template:
<?php
$kirby->email([
'template' => 'email',
'from' => 'yourcontactform@yourcompany.com',
'to' => 'you@yourcompany.com',
'subject' => 'Let us test if MailHog works',
'data' => [
'text' => 'Here is some dummy text',
]
]);
However I can’t get it to work with the controller from the recipe. It’s not giving any errors but also not receiving any emails in mailhog. My config looks like this:
I’ve spend the last 6 hours to get this to work and tried out lots of different things. Also uploading it to a server and use the settings below but this also doesn’t sent any email.
I can’t reproduce this on my end. I set your site up in Valet with PHP 8.3, filled out the registration form with test@example.com, and got a code emailed to Mailhog. I also received a code when I filled out the login form. /test works too.
Hi Luke, Thanks for taking the time to help me out. Could it be a problem with MAMP? I’ve just switched to Herd 1min ago and everything is working the way it should…
Yes that might be the case since I used localhost. Now that you mention it I remember running into a similar problem once while testing a contact form. The browser did output an error back then so I knew what the problem was and what to change. Is there a way of logging these errors as well?