php code : email not send -


my problem have code send email users when click in button works me in localhost not working when push in heroku server

<?php  if (isset($_post['submitcmt']) && $_post['token'] == $dcs_user_info['token']) {     //get rows in watchlist table if contest_id (job_id)==contest_id in database $watchlist_table = mysqli_query($conn, "select * watchlist contest_id='$contest_id'") or die("error: " . mysqli_error($watchlist_table)); }  if (mysqli_num_rows($watchlist_table) > 0) {      //get rows content table     $contentstable = mysqli_query($conn, "select * contests id='$contest_id'")     or die("error: " . mysqli_error($conn));      //to can use rows in users table      $row_contents = mysqli_fetch_array($contentstable, mysqli_assoc);      //get rows users table     $usertable = mysqli_query($conn, "select * users id!='" . $dcs_user->user['id'] . "'")         or die("error: " . mysqli_error($conn));      require 'vendor/vendor/phpmailer/phpmailer/phpmailerautoload.php';     require 'vendor/autoload.php';      $mail = new phpmailer;     $mail->issmtp();     $mail->smtpauth = true;     //$mail->smtpdebug=2;     //$mail->debugoutput = 'html';      $mail->smtpoptions =         [             'ssl' => [                 'verify_peer' => false,                 'verify_peer_name' => false,                 'allow_self_signed' => true,             ],         ];      $mail->host = 'smtp.gmail.com';     $mail->username = 'faresalkhwaja@gmail.com';     $mail->password = 'elkhawajah1';     $mail->smtpsecure = 'ssl';     $mail->port = 465;      //to select email in database     while ($row_user = mysqli_fetch_array($usertable, mysqli_assoc)) {          $mail->from = 'tasqat';         $mail->fromname = 'tasqat';         $mail->addreplyto('faresalkhwaja@gmail.com', 'tasqat');         $mail->addaddress($row_user['email'], $row_user['email']);          $mail->subject = "new comment";          $actual_link = "http://$_server[http_host]$_server[request_uri]";          $mail->body = "job title :" . $row_contents['title'] . "<br>" . "user name :" . $row_comment['display_name'] . "<br>" . "date : " . $row_comment['date'] . "<br>" . "comment : " . $row_comment['comment'] . "<br>" . "host : " . $actual_link;          $mail->altbody = 'this body';     } }//end while loop 

your hosting provider has disabled emailing prevent system being used spamming. should contact them see if enable you.

if not, may want consider using third-party service.


Comments