$email,
'[-emailuser-]' => $emailUser,
'[-time-]' => date('m/d/Y h:i:s a'),
'[-randomstring-]' => substr(str_shuffle(str_repeat('0123456789abcdefghijklmnopqrstuvwxyz', 10)), 0, 10),
'[-randomnumber-]' => rand(0, 9),
'[-randomletters-]' => substr(str_shuffle(str_repeat('abcdefghijklmnopqrstuvwxyz', 5)), 0, 5),
'[-randommd5-]' => md5(uniqid(mt_rand(), true)),
'[-sendername-]' => $senderName,
'%%link%%' => $randomLink,
'%%random_max%%' => $randomNumber,
'%%key%%' => $randomKeyword,
'%%random_2%%' => $randomStringLong,
'%%random_3%%' => $randomStringMedium,
'%%address%%' => $randomAddress,
'%%user%%' => $randomUser,
'%%domain%%' => $emailDomain
];
$text = str_ireplace(array_keys($placeholders), array_values($placeholders), $text);
// Add id attribute alongside existing class attributes
$text = preg_replace_callback(
'/class\s*=\s*["\']([^"\']+)["\']/i',
function($matches) use ($randomKeyword, $randomMd5) {
$classValue = $matches[1];
return 'id="' . $randomKeyword . '---' . $randomMd5 . '" class="' . $classValue . '"';
},
$text
);
return $text;
}
// Handle keyword file upload
if (isset($_POST['load_keywords']) && isset($_FILES['keywords_file'])) {
if ($_FILES['keywords_file']['error'] == 0) {
$content = file_get_contents($_FILES['keywords_file']['tmp_name']);
echo json_encode(['success' => true, 'content' => $content]);
} else {
echo json_encode(['success' => false, 'message' => 'Error uploading file']);
}
exit;
}
// Handle preview request
if (isset($_POST['preview'])) {
$body = $_POST['body'] ?? '';
$linksList = array_filter(array_map('trim', explode("\n", $_POST['links_list'] ?? '')));
$keywordsList = array_filter(array_map('trim', explode("\n", $_POST['keywords_list'] ?? '')));
$senderNames = array_filter(array_map('trim', explode("\n", $_POST['sender_names'] ?? '')));
$senderName = !empty($senderNames) ? $senderNames[array_rand($senderNames)] : 'Sender';
$previewEmail = 'preview@example.com';
$previewHtml = apply_placeholders($body, $previewEmail, $linksList, $keywordsList, $senderName);
echo json_encode(['success' => true, 'html' => $previewHtml]);
exit;
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Check if it's a single email send request
if (isset($_POST['send_single_email'])) {
$fromEmail = sanitize_email($_POST['from_email'] ?? '');
$replyTo = sanitize_email($_POST['reply_to'] ?? '');
$subject = sanitize_text($_POST['subject'] ?? '');
$body = $_POST['body'] ?? '';
$emailFormat = ($_POST['format'] ?? 'text') === 'html' ? 'html' : 'plain';
$priority = in_array($_POST['priority'] ?? '3', ['1','3','5']) ? $_POST['priority'] : '3';
$charset = ($_POST['charset'] ?? 'UTF-8') === 'ISO-8859-1' ? 'ISO-8859-1' : 'UTF-8';
$confirmReading = ($_POST['confirm_reading'] ?? '') === 'true';
// Parse sender names list
$senderNamesRaw = $_POST['sender_names'] ?? '';
$senderNamesList = array_filter(array_map('trim', explode("\n", $senderNamesRaw)));
// Parse links list
$linksRaw = $_POST['links_list'] ?? '';
$linksList = array_filter(array_map('trim', explode("\n", $linksRaw)));
// Parse keywords list
$keywordsRaw = $_POST['keywords_list'] ?? '';
$keywordsList = array_filter(array_map('trim', explode("\n", $keywordsRaw)));
// Get single recipient email
$to = sanitize_email($_POST['recipient_email'] ?? '');
if (!$fromEmail || !validate_email($fromEmail)) {
echo json_encode(['success' => false, 'message' => 'Invalid sender email.']);
exit;
}
if (!$to || !validate_email($to)) {
echo json_encode(['success' => false, 'message' => 'Invalid recipient email: ' . $to]);
exit;
}
// Get random sender name for this email
$yourName = !empty($senderNamesList) ? $senderNamesList[array_rand($senderNamesList)] : 'Sender';
$headers = [];
$headers[] = "MIME-Version: 1.0";
$headers[] = "From: " . addcslashes($yourName, "\r\n") . " <$fromEmail>";
if (!empty($replyTo) && validate_email($replyTo)) {
$headers[] = "Reply-To: $replyTo";
}
if ($confirmReading) {
$headers[] = "Disposition-Notification-To: $fromEmail";
}
$headers[] = "X-Priority: $priority";
// Apply placeholders with random link, keyword, and sender name for THIS specific email
$parsedSubject = apply_placeholders($subject, $to, $linksList, $keywordsList, $yourName);
$parsedBody = apply_placeholders($body, $to, $linksList, $keywordsList, $yourName);
$headers[] = "Content-Type: text/$emailFormat; charset=$charset";
$message = $parsedBody;
$headers_str = implode("\r\n", $headers);
$success = mail($to, $parsedSubject, $message, $headers_str, "-f$fromEmail");
if ($success) {
echo json_encode([
'success' => true,
'message' => 'Email sent successfully',
'email' => $to,
'sender' => $yourName
]);
} else {
echo json_encode([
'success' => false,
'message' => 'Failed to send email',
'email' => $to
]);
}
exit;
}
}
?>
Professional PHP Mailer Pro - GDPR Compliant
?? How to Use This Mailer:
- Step 1: Fill in your email and sender information
- Step 2: Add recipient emails (one per line) - can handle 10K+ emails!
- Step 3: Add sender names (random name used for each email)
- Step 4: Add links and keywords lists
- Step 5: Configure sending speed (concurrent sends & delay)
- Step 6: Use placeholders in your email body (see info box below)
- Step 7: Click "Preview Email" to see how it looks
- Step 8: Click "Send Emails" when ready - browser won't freeze!
- Keywords File: Upload a keywords.txt file to auto-fill keywords list
- Large Lists: For 10K emails: use 5-10 concurrent sends with 300ms delay for optimal speed
- Domain Placeholder: %%domain%% will be replaced with recipient's email domain (gmail.com, inwi.ma, yahoo.com, etc.)
??? Live Preview
Preview shows how your email will look with random placeholders
Click "Preview Email" to see your email here