I’m running a self hosted Ghost personal blog, and I’m setting up some features to interact with the visitors.
What I want is a contact form page so visitors can send me an email. I’ve already see many posts explaining how to configure forms, but they’re using 3rd party services such as Formspree, Getform, Mailgun, etc, and what I want is a contact form using SMTP transport to send the emails to my mailbox.
Using PHP I know how to do that, but honestly I do not have many knowledge on NodeJS to do that.
Is there any way to create our own form using SMTP authentication in Ghost?
You can create your contact form script using php and have the html form you’ve added to your Ghost site submit to your php script that you’re hosting on your server. There’s no requirement to use node.js.
And how can I run php script in Ghost? For example if I create an HTML file in theme root folder, I can access it from browser, but if I create a php script in the same location it will download the file instead of open it.
I’ve already tried to setup the nginx config to run php files with the php-fpm socket but with no success. Could you help me on that?
You don’t, this would be outside of Ghost, most likely served by the web server that sits in front of Ghost as a proxy.
Sounds like you’re heading in the right direction. In the server block for your Ghost site you’ll want an additional location directive for your php files, eg: