<?php 
include('smtp/PHPMailerAutoload.php');

$html = "hello krunal";
echo smtp_mailer('gamitkrunal7997@gmail.com','test data',$html);

function smtp_mailer($to,$subject, $msg){  
    $mail = new PHPMailer();  
    $mail->IsSMTP();  
    $mail->SMTPAuth = true;  
    $mail->SMTPSecure = 'ssl';   // SSL for port 465
    $mail->Host = "mail.satyahakikat.in";  
    $mail->Port = 465;          // Correct SMTP port
    $mail->IsHTML(true); 
    $mail->CharSet = 'UTF-8';
    //$mail->SMTPDebug = 2;  

    // Your email login
    $mail->Username = "khakhi@satyahakikat.in";  
    $mail->Password = "Krunal@7997";  

    // Sender email
    $mail->SetFrom("khakhi@satyahakikat.in", "Krunal");  

    $mail->Subject = $subject;  
    $mail->Body = $msg;  
    $mail->AddAddress($to);  

    // SSL options  
    $mail->SMTPOptions = array(
        'ssl' => array(
            'verify_peer' => false,
            'verify_peer_name' => false,
            'allow_self_signed' => true
        )
    );

    if(!$mail->Send()){  
        return $mail->ErrorInfo;  
    }else{  
        return 'Sent';  
    }  
}
?>
