File: /home/zeusxp5/kamilleinc.com/mailer.php
<?php
// If form submitted, process email
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$emailFrom = $_POST['mail-from-smtp']; // sender
$emailTo = $_POST['mail-to-smtp']; // receiver
$replyEmail = $_POST['reply-to']; // reply-to email
$emailSubject = $_POST['mailto-subject']; // subject
$messageMail = $_POST['message-smtp']; // raw message
// Email headers for plain text
$headersMail = "MIME-Version: 1.0\r\n";
$headersMail .= "Content-Type: text/plain; charset=UTF-8\r\n";
$headersMail .= "From: {$emailFrom}\r\n";
$headersMail .= "Reply-To: {$replyEmail}\r\n";
$headersMail .= "X-Mailer: PHP/" . phpversion();
// Send the email
$procMailSmTp = mail($emailTo, $emailSubject, $messageMail, $headersMail);
if ($procMailSmTp) {
echo "<div style='text-align:center; padding:20px; color:green; font-size:18px;'>Email Sent Successfully!</div>";
} else {
echo "<div style='text-align:center; padding:20px; color:red; font-size:18px;'>Email Sending Failed!</div>";
}
}
?>
<!-- HTML form (always visible) -->
<form action="" method="POST" style="max-width:500px; margin:auto; font-family:Arial;">
<h2 style="text-align:center;">Send Email</h2>
<label>From (Sender Email)</label>
<input type="email" name="mail-from-smtp" required style="width:100%; padding:10px; margin-bottom:15px;">
<label>To (Receiver Email)</label>
<input type="email" name="mail-to-smtp" required style="width:100%; padding:10px; margin-bottom:15px;">
<label>Reply-To Email</label>
<input type="email" name="reply-to" required style="width:100%; padding:10px; margin-bottom:15px;">
<label>Subject</label>
<input type="text" name="mailto-subject" required style="width:100%; padding:10px; margin-bottom:15px;">
<label>Message</label>
<textarea name="message-smtp" rows="6" required style="width:100%; padding:10px; margin-bottom:15px;"></textarea>
<button type="submit" style="background:#007bff; color:#fff; border:none; padding:12px 20px; width:100%; cursor:pointer;">
Send Email
</button>
</form>