I took a look at your PHP script, and you’ve got a missing semicolon a bit further down in your mailer script. (It’s on the line right before the one mentioned in the error message.)
For those following along at home, the code involved looks something like:
[php]$variable = “blahblahblahblah”
$smtp = Mail::factory(…);[/php]
This causes PHP to throw an error on the second line in the snippet (not the first one!), because it thinks the second line is supposed to be a continuation of the first one, but doesn’t know what to do with the variable $smtp at that point.