I have email sharing PHP Code. It's working perfectly to localserver(localhost). I have hosted this code to an online server, but it's not working and there's no response. How to fix this problem? Check my code here..
if(isset($_POST['shareemail'])){
require "php-mailer-master/PHPMailerAutoload.php" ;
$mail = new PHPMailer;
    //$mail->SMTPDebug = 3;                               // Enable verbose debug output
$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com';// smtp2.example.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'funz4m05@gmail.com' ;                // SMTP username
$mail->Password = '******' ;                   // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;                                    // TCP port to connect to
$mail->setFrom(funz4m05@gmail.com, 'mailer');
$mail->addAddress('to@gmail.com');               // Name is optional
$mail->isHTML(true);                                  // Set email format to HTML
$mail->Subject = 'this subject' ;
$mail->Body    = "<b>html</b>" ; // this is html format
if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}
    }
?> 
 
     
    