Thursday, August 25, 2016

PHP for Server Emails



Last week I launched my first "Mobile First" website using Bootstrap3 at <Kai-PDQ.in>. And today I found myself diving deeper into the alphabet soup.

After I launched the website, I realised that there was one functionality that was beyond the magical powers of Bootstrap3: Email Forms that actually sent out emails.

Inside the Bootstrap3 framework, the responsive "containers" could help you create an entire website that would work across mobiles, smartphones, tabs and PCs, but to make them send emails you needed something more: PHP.

PHP is supposed to be the acronym for Hypertext Preprocessor (how is that?). It is apparently a super-popular script executed on the servers which lies at the heart of blogging sites like WorldPress, It is also used extensively by the social media behemoth with more than 1.5 billion users - FaceBook.

So how do you write a PHP script that enables forms on your website to send emails to your Yahoo or Gmail accounts?

As in the case of Bootstrap3, its best to start with a YouTube video tutorial. This is the one that worked for me:

TeachMeComputer: PHP for Beginners - https://www.youtube.com/watch?v=kY5P9sZqFas

Once you get a hang of the basics, its best to dive right in with the code for a basic email form, as described in this video by MushroomHeadBangers - https://www.youtube.com/watch?v=yW5cgqf6cNo

 Then, to install a web server on your PC, you need XAMPP. This tool comes as a package with Apache, MySQL and PHP. Once you have all these things in place, you are ready to go.

One thing none of these video's tell you (perhaps its common knowledge?), is that your web-host needs to have a PHP enabled portal. It is also not clear from the videos how we can go about with the trouble shooting.

My site takes in the feedback form, returns the "Click Here to Go Back" page, and I do get an email in my Yahoo account. However, for some reason, the mails land up in the Spam-box even if they are marked safe. Also, the message is coming in blank with the just the sender's email id.

Some progress...but I guess there is still a long way to go!

-----------------------
LINKS - Responsive Forms

  • PHP Download - http://php.net/downloads.php
  • W3School Tutorial - http://www.w3schools.com/php/php_intro.asp
  • XAMPP - PHP development environment - https://www.apachefriends.org/index.html
  • https://www.formget.com/how-to-make-simple-responsive-form-for-a-website/

No comments: