Hey guys ,Today we are going to create an email sender in php . By which you can send email to anyone with any email id. I am sure that you are thinking that it’s not possible. But yes it is possible by php script. You just need to apply your mind. There is one function named mail() in php. By which you directly send mail to anyone. But for doing that you need to declare four variables. I will describe it after script.Let me discuss about e-mail firstly. E-mail is the online messaging service , Right ? Now a days lots of people receiving thousands of spam by email. They just use this type of scripts to spam anyone’s email account.

Well i have designed one email builder, By which you can send mail to anyone on behalf of anyone’s id. (This is for the education purpose only ). It’s not much complicated,you just need to pass four arguments to the mail() function. But you can not run it into your local server. You have to host that php script to any online hosting service. You can get any free hosting service online and can check your email script. We have hosted our tool online. I will give the link soon.

Script for fake php Email sender

<?php

if(isset($_POST['to'])&&isset($_POST['sub'])&&isset($_POST['body'])&&isset($_POST['myid']))
{
$to=$_POST['to'];
$sub=$_POST['sub'];
$body=$_POST['body'];
$myid=$_POST['myid'];

{
if(!empty($to)&&!empty($sub)&&!empty($body)&&!empty($myid))
{

if(mail($to,$sub,$body,$myid))
{
echo "Done!";
}
}
else
{
echo "fill again";
}
}
}

?>

<form action="mail.php"  method="POST">
<Strong>TO</strong>
<br>

<input type="text" name="to">
<br>
<strong>Subject</strong>
<br>

<input type="text" name="sub">
<br>

<Strong>Body:</strong>
<br>

<textarea rows='6' cols='30' name="body"></textarea>

<br>
<strong>From:</Strong>
<br>
<input type="text" name="myid">
<br>
<br>
<input type="Submit" value="Submit">
<br>
</form>

Logic of the fake php mail sender

Well firstly we created one mail box form which have To,Subject,Body,From elements. We simply use the POST method to get that value directly in php script. Then we first set the values to the particular variables. After that we have checked that is it empty or not, And if it’s not empty then we passed the four element in a rightly manner to the mail() function. It’s over. You can check the working of mail function by simple echo statement. That’s it, You have done it ! Try this script

Output : Live demo of email sender

Aha it’s not finished yet. Do you want to see the live demo for php fake email sender. Here it is

Well we have created this for fun. It’s for your idea about how it’s work.

How to host your php files ?

Well you have to go for hosting. There is one free hosting which i use for testing my works. It’s 000webhost . It’s pretty good because it’s free. You just have to sign up there and then by going to file manager section ,you can easily upload your scripts and check it .

I hope you all like this amazing php tutorial for fake email sender. Keep visiting us and keep sharing. Like our fb page. Happy coding .

By jigar

Leave a Reply

Your email address will not be published. Required fields are marked *