The method used in older version was deprecated.
The new methods are:
If you also have to set the Customer Notification flag, you should rather use the first option by creating first a Mage_Sales_Model_Order_Status_History object.
$historyItem = new Mage_Sales_Model_Order_Status_History();
$historyItem->setComment(‘Order confirmation e-mail sent by cronjob’);