0

I’m making new a static website for a client, and they are wanting a contact form that a user could fill out and it will send the enquiry to the clients email.

The client is currently using cPanel as their web host manager, on what I believe is an Apache server. I don’t actually know what server side language that it would be using as I don’t have access to their cPanel account.

I was initially thinking I could create a PHP script that would use the mail() function, and I would put that into the public_html folder with the rest of the static site, and so when the user submits a POST request, the forms action will call that PHP script.

But from what I’ve read, that isn’t the best way to go about it and instead I should be using an Simple Mail Transfer Protocol (SMTP). I have a vague idea of what this is from googling, but have no idea how to implement such a thing.

I’m typically used to creating sites with React.js/ Gatsby.js, Node.js, Netlify, and so I’ve had no experience with cPanel and the like.

Has anyone done something similar or has any advice? Any thing will be much appreciated!

1 Answers1

1

I think the first step is to get many information as you could about the available server structure. It is very hard to elaborate on any good solution without having control and/or knowledge about the server-side: maybe a tool or resource you use for implementing an SMTP-based solution could not be available to you when deploying it.

You could try to argue with your client on the importance of knowing the server structure. Use arguments on quality of service, security, among others.

If you get the server information, consider use PHPMailer if the server provides you with the required resources and dependencies.

If you could not have that information, the solution you think first ( use mail() ) will probably work. Great discussions about the topic occurred here.

However, firstly ensure that the server offers email sending service. It would be hard if it does not offer that service, but it is a possibility.

Erme Schultz
  • 319
  • 5
  • 17