Reputation: 1
I'm brand new to coding and I need help. I've basically been using ChatGPT as a crutch while teaching myself CSS, HTML, PHP and a few other languages from scratch.
I'm working for a startup. I created the entire site in Webflow, however the Webflow provided contact forms do not work unless published via the site. Unfortunately due to data control concerns I've been disallowed form publishing using this method. Thus the PHP forms must be written.
I'm facing issues with sending emails from my PHP webpage using PHPMailer. I've set up MailHog as the SMTP server, and while the emails are captured in MailHog, they don't make it to Thunderbird. I've checked the spam folder and reviewed my PHP code. How can I identify the issue and ensure emails are delivered correctly to Thunderbird?
I'm working on a PHP webpage that uses PHPMailer to send emails. I've configured the script to use MailHog as the SMTP server for testing purposes. When submitting the form, the emails are successfully captured in MailHog, but they are not reaching my Thunderbird client. I've checked the spam folder in Thunderbird and reviewed the PHP code for any issues. My expectation is that the emails sent via PHPMailer should be delivered to Thunderbird.
Upvotes: 0
Views: 105
Reputation: 37730
I think you have not quite understood the roles of Mailhog and Thunderbird.
Mailhog is a testing service that receives messages via SMTP, and just stores them, doesn’t forward them to real recipients. You can configure it to forward messages to a proper delivery server, e.g. gmail, but by default it doesn’t do that, and it doesn’t sound like you have done that either. From their description:
MailHog is an email testing tool for developers:
Configure your application to use MailHog for SMTP delivery
View messages in the web UI, or retrieve them with the JSON API
Optionally release messages to real SMTP servers for delivery
To receive messages, Thunderbird needs to collect messages from an IMAP server, but as far as I know, Mailhog doesn’t provide an IMAP service, so not surprisingly, you’re not receiving the messages in there.
So, configure Mailhog to forward to a real mail server, and set up Thunderbird to collect from there.
It’s worth noting that Mailhog is intended for testing rather than production use, so you might want to consider setting PHPMailer to send directly through a proper mail server.
Upvotes: 1