Unable to send email from PHP using smtp with PHPMailer

Unable to send email from PHP using smtp with PHPMailer


<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
            require_once './resources/PHPMailer-master/PHPMailerAutoload.php';
            $mail = new PHPMailer;
            $mail->SMTPDebug = 4;                         
            $mail->isSMTP();                                     
            $mail->Host = 'smtp.zoho.com'; 
            $mail->SMTPAuth = true;                   
            $mail->Username   = " example@mydomain.com"; 
            $mail->Password   = "password";
            $mail->SMTPSecure = 'ssl';                          
            $mail->Port = 465;

            $mail->From = 'example';
            $mail->FromName = 'Doe';
            $mail->addAddress('sending address, 'John');     // Add a recipient              // Name is optional
            $mail->isHTML(true);                                  // Set email format to HTML
            $mail->Subject = 'Here is the subject';
            $mail->Body    = 'This is the HTML message body <b>in bold!</b>';
            $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

            if(!$mail->send()) {
                echo 'Message could not be sent.';
                echo 'Mailer Error: ' . $mail->ErrorInfo;
            } else {
                echo 'Message has been sent';
            }
        ?>
    </body>
</html> 

 
Though it works perfectly on my localhost, it doesn't work from my server . (it has open ssl )