I am trying to use swiftmailer for the first time. I am getting a number of errors when I use the code below, including this one: “unexpected T_OBJECT_OPERATOR.”
Any thoughts on what I might be doing wrong here?
require_once('/home/name/php/lib/swift_required.php');
$transport = Swift_SendmailTransport::newInstance('/usr/sbin/exim -bs');
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance();
->setSubject('Inquiry');
->setFrom(array('email@example.com' => 'Inquiry'))
->setTo(array('email@example.com' => 'John Doe'))
->setBody('Test inquiry message');
$numSent = $mailer->send($message);
printf("Sent %d messages\n", $numSent);
$result = $mailer->send($message);
You had
;afterSwift_Message::newInstance()causing parse error in PHP