Index of /ALFA_DATA/cgialfa/591218862

 NameLast modifiedSizeDescription

 Parent Directory   -  
 849132630.txt 2023-08-14 18:39 3.5K 

<?php 
require 'vendor/autoload.php';

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;



$mail = new PHPMailer(true);

//print_r($_POST);

    //$to = "info@folklore.co.ke"; // this is your Email address
    $to = "comark@socialmedia.co.ke"; 
    $from = "wekeza@mg.invest.go.ke"; // this is the sender's Email address

    $subject = "Wekeza Dada Form Submission";
    //$subject2 = "Copy of your form submission";
    $message = "TEst  submitted the following:";
        
    //$message2 = "Here is a copy of your message " . $first_name . "\n\n" . $_GET['messagefolk'];

   // $headers = "From:" .$_POST['email'];
        //mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
    //echo "Your message has been sent. <br> Thank you " . $fname . ", we will contact you as soon as possible.";
    // echo "Your message has been sent. <br> Thank you " . $fname . " ".$lname.", we will contact you as soon as possible.";
    //$headers2 = "From:" . $to;
    //mail($to,$subject,$message,$headers);
    /*
// First, instantiate the SDK with your API credentials
$mg = Mailgun::create('e1a6a5235f6e9a4d7e0b33f8cc7f2e11-ee16bf1a-3025dce0'); // For US servers
//$mg = Mailgun::create('key-example', 'https://api.eu.mailgun.net'); // For EU servers

// Now, compose and send your message.
// $mg->messages()->send($domain, $params);
$mg->messages()->send('mg.invest.go.ke', [
  'from'    => $from,
  'to'      => $to,
  'subject' => $subject,
  'text'    => $message
]);*/

try {
    $mail->SMTPDebug = 2;                                   
    $mail->isSMTP();                                            
    $mail->Host  = 'smtp.mailgun.org';                 
    $mail->SMTPAuth = true;      
    $mail->Username = 'postmaster@mg.invest.go.ke';              
    $mail->Password = 'e1d5b192a6435edf1b9bde49a29619c2-ee16bf1a-ff62a84d';                      
    //$mail->Username = 'wekeza@mg.invest.go.ke';              
    //$mail->Password = 'c46de18b71967233ffd3a74bec3c53d0-ee16bf1a-a7f3a67b';
    $mail->SMTPSecure = 'tls'; 
    $mail->Port  = 587;

    /*$mail->Host  = 'smtp.sendgrid.net';                 
    $mail->SMTPAuth = true;                         
    $mail->Username = 'apikey';              
    $mail->Password = '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'; 
    
    $mail->SMTPSecure = 'tls';                          
    $mail->Port  = 587;*/
    /*
    $mail->Host  = 'smtp.sendgrid.net';                 
    $mail->SMTPAuth = true;                         
    $mail->Username = 'apikey';              
    $mail->Password = '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'; 
    
    $mail->SMTPSecure = 'tls';                          
    $mail->Port  = 587;*/
    $mail->SMTPOptions = array(
           'ssl' => array(
                    'verify_peer' => false,
                    'verify_peer_name' => false,
                    'allow_self_signed' => true
                )
            ); 

    $mail->setFrom('wekeza@mg.invest.go.ke');
    $mail->addAddress('comark@socialmedia.co.ke');
    $mail->isHTML(true);                                
    $mail->Subject = "Wekeza Test";
    $mail->Body = $message;
    //$mail->AltBody = 'Body in plain text for non-HTML mail clients';
    $mail->send();
    echo "Your message has been sent. <br> Thank you " . $fname . ", we will contact you as soon as possible.";
} catch (Exception $e) {
    echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}



?>