Threat Intelligence
How to use Email Spoofing
This PHP code allows the sending of spoofed emails by customizing the From address and email headers. It leverages the mail() function to send emails, enabling the specification of any sender address. Such scripts can be used for testing email security but should be used ethically and legally.
3 min read
![Email Spoofing PHP](/_astro/spoof.a2a44c78_ZXhyT2.webp)
Requirements
- Apache Server
- No Need any MX Records
Source Code
Download Latest Source Code from Github Release
FAQs
- Can I run this code on static website? Answer: Impossible. You need an apache server. CPanel, or VPS. You can run this code on free hosting server as well.
- Is it risky to run this on a personal server? Answer: Yes. Please make sure you have use this code for educational purpose only.
Watch How to Host
Source Code Overview
<?php
if (isset($_POST['ajax'])) {
$to = $_POST['to'];
$subject = $_POST['sub'];
$msg = $_POST['msg'];
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= "From: ".$_POST['name']."<".$_POST['from'].">";
$send = mail($to,$subject,$msg,$headers);
if ($send) {
echo "<p id='success'> সেন্ড হইছে, ইয়ো! ✔️ $to</p>";
}else{
echo "<p id='error'>সরি! যায় নি! ❌ $to</p>";
}
exit();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="https://fonts.googleapis.com/css?family=Montserrat|Roboto" rel="stylesheet">
<link rel="icon" href="fav.svg">
<title>MAIL SPOOFER - Rialms</title>
<style>
body{
margin: 0;
padding: 0;
background: #00bf8f; /* fallback for old browsers */
background: -webkit-linear-gradient(to right, #001510, #00bf8f); /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to right, #001510, #00bf8f); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}
::placeholder {
color: red;
opacity: .9;
font-size: 15px!important;
}
.main{
max-width: 768px;
margin: 0 auto;
}
#title{
color: #e3b8b9;
text-shadow: 0 0 20px #a00000;
text-align: center;
font-family: Montserrat;
}
.responsive {
max-width: 100%;
height: auto;
}
input[type="text"]{
background: #BA5370; /* fallback for old browsers */
background: -webkit-linear-gradient(to right, #F4E2D8, #BA5370); /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to right, #F4E2D8, #BA5370); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
box-shadow: 0 0 11px 0px lime;
height: 40px;
width: 47%;
border: none;
border-radius: 4px;
padding: 15px;
margin: 1%;
box-sizing: border-box;
outline: none;
transition: .5s ease-in;
color: red;
font-family: Montserrat;
font-size: 14px;
}
input[type="text"]:hover{
box-shadow: 0 0 11px 0px red;
}
#sub{
width: 96.5%;
}
textarea{
background: #F00000; /* fallback for old browsers */
background: -webkit-linear-gradient(to right, #DC281E, #F00000); /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to right, #DC281E, #F00000); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
box-shadow: 0 0 11px 0px lime;
height: 300px;
width: 47%;
max-width: 49%;
border: none;
border-radius: 4px;
padding: 15px;
margin: 1%;
box-sizing: border-box;
outline: none;
transition: .5s ease-in;
color: white;
font-family: Montserrat;
font-size: 14px;
}
textarea:hover{
box-shadow: 0 0 11px 0px red;
}
#btn{
background-color: #f00000;
box-shadow: 0 0 11px 0px lime;
width: 96.5%;
height: 40px;
margin-left: 5px;
margin-bottom: 40px;
color: honeydew;
border: none;
border-radius: 4px;
font-family: Montserrat;
font-size: 18px;
font-weight: bold;
letter-spacing: 1px;
box-sizing: border-box;
outline: none;
transition: 4.5s ease-in;
cursor: pointer;
}
#btn:hover{
color: red;
}
#success{
font-family: Montserrat;
color: green;
}
#error{
font-family: Montserrat;
color: red;
}
</style>
</head>
<body>
<form action="" method="post">
<div class="main" style="margin-top: 100px;">
<h1 id="title"><img src="logo.png" alt="EMAIL SPOOFER - Rialms" class="responsive" width="600" height="400"></h1>
<div>
<input type="text" name="from" id="from" placeholder="From Email">
<input type="text" name="name" id="name" placeholder="From Name">
</div><br>
<div>
<input type="text" name="sub" id="sub" placeholder="Subject">
</div><br>
<div>
<textarea name="msg" id="msg" placeholder="Message Text or HTML code"></textarea>
<textarea name="to" id="to" placeholder="Mailist"></textarea>
</div>
<div><br><br>
<button id="btn" onclick="return false">SEND</button>
</div>
<div id="result"></div>
</div>
</form>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#btn").on('click',function(){
var mailist = $("#to").val().split("\n");
var tmailist = mailist.length;
for (var current = 0; current < tmailist; current++) {
var from = $("#from").val();
var name = $("#name").val();
var sub = $("#sub").val();
var msg = $("#msg").val();
var to = mailist[current];
var data = "ajax=1&from=" + from + "&name=" + name + "&sub=" + sub + "&msg=" + msg + "&to=" + to;
$.ajax({
type : 'POST',
data: data,
success: function(data) {
$("#result").append(data);
}
});
}
});
});
</script>
</body>
</html>