Am creating a file to send email with swift mailer. I got a error like
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in mail.php on line 4
But it working in xampp localhost
this is my code:
<?php
require_once 'swift/lib/swift_required.php';
$transport = (new Swift_SmtpTransport('smtp.gmail.com', 465, 'ssl'))
->setUsername('[email protected]')
->setPassword('password')
;
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('Wonderful Subject')
->setFrom(array('[email protected]' => 'Name'))
->setTo(array('[email protected]'=> 'A name'))
->setBody('Test Message Body')
;
$result = $mailer->send($message);
?>
My hosting version is PHP 5.2.17