Monday 29 April 2013

Introducing FlexMailer

If you are a web developer, chances are that you may have written a PHP mail script, either for your own site or for your client. PHP is baked in with Apache, which makes it the most widely used scripting language. The success of Wordpress as CMS is largely because of ease of setup. It's no secret that wordpress is written in PHP.

All right coming back to php. PHP has a built in mail() function that enables websites to email data through the server, instead of the traditional mailto method. This has empowered web developers to include a mail form in their websites, which leads to better UX.
A php mail script usually looks like this

As you can see that for every field you add in HTML form it has to referenced in the PHP script. This is a tedious task to do and every time you work on a new form, you have to rewrite the whole script.
As a solution I have developed a script in jQuery/PHP which automates the entire tasks by automatically retrieving the names and their values. You can find FlexMailer here .

Below is a basic code that shows how you can customize FlexMailer.

Add this script to your HTML.(Load jQuery first)

Now in the mailer.php file
Find this line
and put in your email id.
Thats it you are good to go.
BTW, I am looking for collaborators to make FlexMailer better, if you're interested drop a comment below.
A question regarding FlexMailer script on StackOverflow

2 comments:

  1. well.. we have three problems here..

    First of all what about spam filters? you must use some header information!

    Second. sure? send just text? nothing about HTML?

    And finally what about spammers bot!? you won't use any captcha?

    ReplyDelete
    Replies
    1. @Nicolas , thanks for pointing out. I developed this script to test somethings at work. Will work around your points.
      An I am primarily not a PHP developer, that's why I am looking for developers to contribute.
      Wanna join in ? :)

      Delete