

<?php

extract($_REQUEST);

$ma = "mkat.info@gmail.com";
$mas ="Dear $username,\n\nThank you for your donation. Your donation has been successfully recorded.\n\nBest regards,\nYour Team";

// Recipient 
$to = $ma;
$from = 'maniram8694@saivamfoods.com';
$fromName = 'test';

// Email subject 
$subject = "Donation Confirmation";
$message = "Dear $username,\n\nThank you for your donation. Your donation has been successfully recorded.\n\nBest regards,\nYour Team";

// Email body content 
$htmlContent = '<h3>' . $message . '</h3>';

// Header for sender info 
$headers = "From: $fromName" . " <" . $from . ">";

// Boundary  
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

// Headers for attachment  
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";

// Multipart boundary  
$message = "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"UTF-8\"\n" .
    "Content-Transfer-Encoding: 7bit\n\n" . $htmlContent . "\n\n";

$mail = mail($to, $subject, $mas, $headers);

if ($mail) {
   echo "Mail Sent";
} else {
    // Get the last error
    $error = error_get_last();
    echo "Error sending email: " . $error['message'];
}

// Function to send an email to the logged-in user
function sendEmailNotification($username) {
    // Fetch the user's email based on the username
$ma = $username;
$mas ="Dear $username,\n\nThank you for your donation. Your donation has been successfully recorded.\n\nBest regards,\nYour Team";

// Recipient 
$to = $ma;
$from = 'maniram8694@myprojectfinal.in';
$fromName = 'test';

// Email subject 
$subject = "Donation Confirmation";
$message = "Dear $username,\n\nThank you for your donation. Your donation has been successfully recorded.\n\nBest regards,\nYour Team";



// Headers for attachment  
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";

// Multipart boundary  
$message = "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"UTF-8\"\n" .
    "Content-Transfer-Encoding: 7bit\n\n" . $htmlContent . "\n\n";

$mail = mail($to, $subject, $mas, $headers);

if ($mail) {
   echo "Mail Sent";
} else {
    // Get the last error
    $error = error_get_last();
    echo "Error sending email: " . $error['message'];
}
 
   
}


?>
