After 10+ years in the web hosting industry, I still encounter web developers that are not using SMTP for the websites contact forms or any form that sends e-mails and I’m wondering if there is any reason for that? Why would you still use mail(); in 2019 when most of the mail servers will consider your messages as SPAM if you are not sending them via authenticated SMTP?
Nobody was able to answer this question so I’ve decided to find the answer by myself. I’ve contacted different web developers and web design agencies on the Internet and asked them for their portfolios, to see what websites they created and after that, I’ve asked them if they use mail(); or SMTP and if they see any differences, pros or cons between these two. I was in surprised to find that most of them have no idea why SMTP should be mandatory when it comes to forms that are sending emails. I was in shock to see that many of them have no idea how to do that?! I’m not judging anyone here, but guys, if you advertise yourself as a respectable web developer, you should be able to create a simple PHP form that sends the messages via SMTP.
Anyway, who am I to judge? Dragos, better give some help and hope for the best!
Here is a Simple PHP and HTML contact form – you can see it and if you like it, download the code from GitHub and use it on your websites. The code is self explanatory and you should not encounter any issues with that. However, in case something is still no working, get in touch with your web hosting company and ask them for the SMTP details. (not all the companies have the same SMTP details).