File: //proc/thread-self/root/proc/thread-self/cwd/n.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bulk Email Sender White Cash</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
background-color: #f4f4f9;
}
.container {
width: 700px;
padding: 30px;
background: #fff;
box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.2);
border-radius: 10px;
}
h2 {
text-align: center;
color: #333;
font-size: 24px;
}
form {
display: flex;
flex-direction: column;
}
label {
margin-top: 15px;
color: #555;
font-size: 18px;
}
input, textarea, button {
padding: 12px;
margin-top: 8px;
border: 1px solid #ddd;
border-radius: 5px;
font-size: 18px;
width: 100%;
resize: vertical;
}
textarea {
height: 150px;
}
button {
background-color: #5a67d8;
color: white;
border: none;
cursor: pointer;
transition: background-color 0.3s;
font-size: 20px;
padding: 15px;
margin-top: 20px;
}
button:hover {
background-color: #4c51bf;
}
.result {
margin-top: 15px;
padding: 15px;
color: white;
border-radius: 5px;
text-align: center;
font-size: 18px;
}
.success {
background-color: #48bb78;
}
.error {
background-color: #f56565;
}
.preview {
padding: 15px;
border: 1px solid #ddd;
border-radius: 5px;
background-color: #f4f4f9;
margin-top: 20px;
}
.loading {
margin-top: 15px;
font-size: 18px;
text-align: center;
}
</style>
<script>
function previewMessage() {
const message = document.getElementById('message').value;
const previewDiv = document.getElementById('preview');
previewDiv.innerHTML = message; // Render HTML content
previewDiv.style.display = 'block';
}
function clearData() {
document.getElementById('senderName').value = '';
document.getElementById('senderEmail').value = '';
document.getElementById('to').value = '';
document.getElementById('subject').value = '';
document.getElementById('message').value = '';
document.getElementById('preview').style.display = 'none';
document.getElementById('loading').style.display = 'none';
}
</script>
</head>
<body>
<div class="container">
<h2>Bulk Email Sender</h2>
<form method="post">
<label for="senderName">Sender Name:</label>
<input type="text" id="senderName" name="senderName" placeholder="e.g., John Doe" required value="<?php echo isset($_POST['senderName']) ? htmlspecialchars($_POST['senderName']) : ''; ?>">
<label for="senderEmail">Sender Email:</label>
<input type="email" id="senderEmail" name="senderEmail" placeholder="e.g., sender@example.com" required value="<?php echo isset($_POST['senderEmail']) ? htmlspecialchars($_POST['senderEmail']) : ''; ?>">
<label for="to">Recipient Emails (one per line):</label>
<textarea id="to" name="to" placeholder="Enter each email on a new line" required><?php echo isset($_POST['to']) ? htmlspecialchars($_POST['to']) : ''; ?></textarea>
<label for="subject">Subject:</label>
<input type="text" id="subject" name="subject" required value="<?php echo isset($_POST['subject']) ? htmlspecialchars($_POST['subject']) : ''; ?>">
<label for="message">Message Template (supports HTML):</label>
<textarea id="message" name="message" placeholder="Type your HTML or text message here" required><?php echo isset($_POST['message']) ? htmlspecialchars($_POST['message']) : ''; ?></textarea>
<button type="button" onclick="previewMessage()">Preview Message</button>
<button type="submit" name="sendEmail">Send Bulk Emails</button>
<button type="button" onclick="clearData()">Clear Data</button> <!-- Clear Data button -->
</form>
<div id="preview" class="preview" style="display: none;"></div>
<div id="loading" class="loading" style="display: none;"></div>
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['sendEmail'])) {
$senderName = htmlspecialchars($_POST['senderName']);
$senderEmail = htmlspecialchars($_POST['senderEmail']);
$to = htmlspecialchars($_POST['to']);
$subject = htmlspecialchars($_POST['subject']);
$message = $_POST['message']; // Accept HTML content directly
$recipients = preg_split('/\r\n|\r|\n/', $to); // Split emails by new lines
// Save input data to a log file
$logData = [
'senderName' => $senderName,
'senderEmail' => $senderEmail,
'recipients' => $recipients,
'subject' => $subject,
'message' => $message,
'timestamp' => date('Y-m-d H:i:s')
];
file_put_contents('email_log.txt', json_encode($logData) . PHP_EOL, FILE_APPEND);
// Set headers with sender information and HTML content type
$headers = "From: $senderName <$senderEmail>\r\n";
$headers .= "Reply-To: $senderEmail\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$sentCount = 0;
$errorCount = 0;
foreach ($recipients as $index => $email) {
$email = trim($email); // Remove whitespace around each email
echo "<script>document.getElementById('loading').innerHTML = 'Sending email " . ($index + 1) . "/" . count($recipients) . "...';</script>";
echo "<script>document.getElementById('loading').style.display = 'block';</script>";
flush();
ob_flush();
if (filter_var($email, FILTER_VALIDATE_EMAIL)) { // Validate email format
if (mail($email, $subject, $message, $headers)) {
$sentCount++;
echo "<script>document.getElementById('loading').innerHTML += '<span style=\"color: green;\"> Sent successfully: $email</span><br>'; </script>";
} else {
$errorCount++;
echo "<script>document.getElementById('loading').innerHTML += '<span style=\"color: red;\"> Failed to send: $email</span><br>'; </script>";
}
} else {
$errorCount++;
echo "<script>document.getElementById('loading').innerHTML += '<span style=\"color: red;\"> Invalid email: $email</span><br>'; </script>";
}
flush();
ob_flush();
}
// Display the result messages
if ($sentCount > 0) {
echo "<div class='result success'>Successfully sent $sentCount emails!</div>";
}
if ($errorCount > 0) {
echo "<div class='result error'>Failed to send $errorCount emails.</div>";
}
}
?>
</div>
</body>
</html>