cara kirim email dengan php pada sll atau tls

[php]

$host = "ssl://mail.bernofarm.co.id";
$port = "465";
$username = "freddo@bernofarm.co.id";
$password = "freddo";

$headers = array(‘From’ => $from,
‘To’ => $to,
‘Subject’ => $subject);
$smtp = Mail::factory(‘smtp’, array(‘host’ => $host,
‘port’ => $port,
‘auth’ => true,
‘username’ => $username,
‘password’ => $password));
//    echo "to = " . $to;
//    echo "<br>subject = " . $subject;
echo "<br> Headers =" . $headers;
var_dump($headers);
$mail = $smtp->send($to, $headers, $body);
$mails = $smtp->send($from, $headers, $body);
//    $mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail) && PEAR::isError($mails)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>" . $reportSentToMail);
}

[/php]