Saturday, July 30, 2011

ZONTEK Releases #Project : MAIL4EVERY1 - Send mails from mail() disabled web hosts

Hellow guys,
And after some looong like time, ZONTEK released another FREE AND OPEN product just for you all. Project Mail4Every1. So beyond this part, this will be the official documentation of the script.

REMEMBER WE ARE NOT DISCRIMINATING ON ANY WEB SERVICE PROVIDER BUT USING THEM AS EXAMPLES.


What is Project MAIL4EVERY1?

Mail4Every1 is a simple script that would allow any one to send emails even if the webhost allows the mail() or not or even it doesnt have a mail server at all. It is simply another function (zmail()) to sustitue for the default php mail() function.

How it Works?

It's just simple, no rocket science included Smile. What the script does is to use a server that has already enabled the mail() function to act as the mail server of your host. 

LOGIC: 
1. You call the zmail() function
2. zmail() does a *hidden* AJAX call to another php script hosted in a host with mail() enabled
3. the second host sends the message with the details given in the first one

That's it!

Lets begin the interesting part Big Grin

Requirements :

1.Mailer.php ->the official script which contains the zmail() function
2. A host with mail() enabled
Now you think why on the earth i would not use that host without doing all those hard stuff. The reason is many reliable web hosting providers doesnt allow the use of the mail() function as it can be easily abused. But there are plenty of free web hosting sites to help you in the task of doing it
ex: i use zymic.com [I AM NOT TELLING ANYTHING WRONG ABOUT THIS HOST, JUST FOR THE EXPLANATION I USE IT]
i dont get the mail() unless i give $10. I simple cannot afford Smile so i use another free host like freehostingcloud as the second host and use this script to send the mail. Got it? 

3. Mail.php -> This one should be there in the second host to be called from the first

Download the mailer.zip
View Live Demo



Usage:

1. First download the zip file and extract, and you will get 2 files in the "zmail" directory
mailer.php ->the script
jquery.js -> T[COLOR="Red"]HIS IS CRITICAL TO BE THERE[/COLOR]

2. Now upload these to your web host.
ex: http://site.zymic.com/mailtest/mailer.php

3.You need a free host that will allow to use the mail() function, i used the site http://freehostingcloud.com for mine. Make a new account there and upload the mail.php you found on the "zmail" directory.
ex: http://site.freehostingcloud.com/mail.php


4. Now we need to call the zmail() function from another php script which will accept the POST data from a html form. You can find the index.php and mail2.php in the "demo" directory in the file you downloaded. Upload that to the SAME directory as before
So we will make a simple a php script, it is just as calling the normal mail() function.

mail2.php

PHP Code:
<?phpinclude "mailer.php";

if(isset(
$_POST['send'])){
$url "http://site.freehostingcloud.com/mail.php";$to=$_POST['to'];$from=$_POST['from'];$name=$_POST['name'];$sub=$_POST['sub'];$msg=$_POST['msg'];
zmail($url,$to,$from,$name,$sub,$msg);

}

?>

NOTE: the usage of zmail() function;

$url - the path where the php script that do the actual mailing is [in the server where mail() is allowed]
$to - the reciever of the mail
$from - the sender's email [NOTE That some free hosting requires that the sender mail should be registered at the control panel first]
$name - the sender's name
$sub - the subject of the message
$msg - the mail content

Now to call this script a little HTML form

index.php
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>#Project : Mail4Every1 ZONTEK</title>
</head>
<body>
*****************************************
#PROJECT MAIL4EVERY1
*****************************************

<form action="mail2.php" method="post">
<table border="0">
<tbody>
<tr>
<td>To :</td>
<td><input type="text" name="to" /></td>
</tr>
<tr>
<td>From :</td>
<td><input name="from" type="text" /></td>
</tr>
<tr>
<td>From Name :</td>

<td><input name="name" type="text" /></td>
</tr>
<tr>
<td>Subject :</td>
<td><input name="sub" type="text" /></td>
</tr>
<tr>
<td>Message :</td>
<td><textarea cols="50" rows="15" name="msg"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Send" name="send" /></td>
</tr>

</tbody></table>
</form>
</body>
</html>



5. Upload these to the same drectory where mailer.php is

6. Now browse your zymic URL
http://site.zymic.com/mailtest
you will find a simple form
Put the details in there, make sure you have done the steps corectly and push the Send button
You will be redirected to the mail2.php and then a little loading like sign and then everying done!

VIOLAAA!! Big Grin
you will recieve your mail SOON... Big Grin

Thats is basically the thing, but there are some things to be put

1.THIS SCRIPT IS FOR EDUCATIONAL PURPOSES AND FOR THE USAGE FOR A GOOD REASON ONLY
2. PLEASE DONOT USE THIS SCRIPT FOR SPAMMING
3. THIS IS COMPLETELT FREE AND OPEN, DO WHAT EVER YOU LIKE BUT DONT FORGET TO MENTION US : http://zontek.zzl.org
4. PLEASE DONATE ME TO PAY FOR MY ELECTICITY BILL : Big Grin (if you like to donate my paypal is manzzup@gmail.com)

Links:

My Blog
ZONTEK official Site


Cyah All

No comments:

Post a Comment