
<!-- CONTACT-->
<?php
// Load WordPress core functionality
require_once($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');

if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['action']) && $_POST['action'] === 'napas_submit_email') {
    // Collect form data
    $name = $_POST['name'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $subject = $_POST['subject'];
    $message = $_POST['message'];

    // Compose email subject
    $email_subject = "New Napas Agro Processors | Snap Juice Inquiry";

    // Compose email message
    $to = "info@napas.co.ug";
    $email_body = "Name: $name\n";
    $email_body .= "Email: $email\n";
    $email_body .= "Phone: $phone\n";
    $email_body .= "Subject: $subject\n";
    $email_body .= "Message:\n$message\n";

    // Set email headers
    $headers = "From: Napas Agro Processors <noreply@lwegatech.com>\r\n";
    $headers .= "Reply-To: $email\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/plain; charset=UTF-8\r\n";

    // Send email
    if (mail($to, $email_subject, $email_body, $headers)) {
        // Redirect on success
        header("Location: /contact/?status=success");
    } else {
        // Redirect on failure (consider adding error logging here)
        header("Location: /contact/?status=error");
    }exit;
}
?>




<!--DISTRIBUTOR-->
<?php
// Load WordPress core functionality
require_once($_SERVER['DOCUMENT_ROOT'].'/napas/wp-load.php');

if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['action']) && $_POST['action'] === 'napas_distributor_email') {
    // Collect form data
    $name = $_POST['name'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $business = $_POST['business'];
    $location = $_POST['location'];
    $experience = $_POST['experience'];
    $message = $_POST['message'];

    // Compose email subject
    $email_subject = "New Distributor Registration";

    // Compose email message
    $to = "ademun@lwegatech.com";
    $email_body = "Name: $name\n";
    $email_body .= "Email: $email\n";
    $email_body .= "Phone: $phone\n";
    $email_body .= "Business Name: $business\n";
    $email_body .= "Location: $location\n";
    $email_body .= "Years of Experience: $experience\n";
    $email_body .= "Why Become a distributor:\n$message\n";

    // Set email headers
    $headers = "From: Napas Agro Processors <noreply@lwegatech.com>\r\n";
    $headers .= "Reply-To: $email\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/plain; charset=UTF-8\r\n";

    // Send email
    if (mail($to, $email_subject, $email_body, $headers)) {
        // Redirect on success
        header("Location: /become-a-distributor/?status=success");
    } else {
        // Redirect on failure (consider adding error logging here)
        header("Location: /become-a-distributor/?status=error");
    }exit;
}
?>



<!--FARMER-->
<?php
// Load WordPress core functionality
require_once($_SERVER['DOCUMENT_ROOT'].'/napas/wp-load.php');

if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['action']) && $_POST['action'] === 'napas_farmer_email') {
    // Collect form data
    $name = $_POST['name'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $farm = $_POST['farm'];
    $location = $_POST['location'];
    $crops = $_POST['crops'];
    $message = $_POST['message'];

    // Compose email subject
    $email_subject = "New Farmer Partner Registration";
    
    // Compose email message
    $to = "ademun@lwegatech.com";
    $email_body = "Name: $name\n";
    $email_body .= "Email: $email\n";
    $email_body .= "Phone: $phone\n";
    $email_body .= "Farm Size: $farm acres\n";
    $email_body .= "Location: $location\n";
    $email_body .= "Types of Crops Grown: $crops\n";
    $email_body .= "Why Become a Farmer Partner:\n$message\n";

    // Set email headers
    $headers = "From: Napas Agro Processors <noreply@lwegatech.com>\r\n";
    $headers .= "Reply-To: $email\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/plain; charset=UTF-8\r\n";

    // Send email
    if (mail($to, $email_subject, $email_body, $headers)) {
        // Redirect on success
        header("Location: /become-a-farmer-partner/?status=success");
    } else {
        // Redirect on failure (consider adding error logging here)
        header("Location: /become-a-farmer-partner/?status=error");
    }exit;
}
?>