I am using php mailer to generate mails but the code works fine on local machine but when i uploaded the same on my server its giving this error (Extension missing: openssl Mailer Error: Extension missing: openssl), I have opened 587 port as well, Still its not working
require 'phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'abc@gmail.com';
$mail->Password = 'secret';
$mail->SMTPSecure = 'tls'; // Even ssl is not working
//$mail->Port = 587;
$mail->setFrom('abc@gmail.com', 'abc');
$mail->addAddress('def@yahoo.com', 'DEF');
$mail->isHTML(true);
$mail->Subject = 'Subject here';
$mail->Body = 'Body Goes here';
if(!$mail->send())
echo 'Mailer Error: ' . $mail->ErrorInfo;
else
echo 'Mail Sent';
Even i removed port no from the code it worked on local machine but not on server, I feel i have to make some changes on the server. i have checked server settings with phpinfo() function, The setting are almost similar like my local machine