php mailer (missing brackets?)

ststesting used Ask the Experts™
This is setting up a swift mail script, I'm getting this error.
Parse error: syntax error, unexpected $end in mailer.php on line 176 (last line).

Looks like I'm supposed to be missing a bracket, but I can't find it...I need some different eyes on this.

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®


The Header directive is an HTML directive not PHP.  It belongs outside the closing PHP tag.  Try the code below.

$result = $mailer->send($message);

header("Location: HTTP://domain/thank-you.html")

Best regards,



Thanks for the help, I moved that below, or just deleted it for now. My last line of code ($result...) is still highlighted like it didn't fix the problem.
Looks like there were two things, I missed a ; on line 121 $to =

And the EOD; cannot be indented.
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

In your code the EOD; on lines 95, 102, etc. must be in the first column.  It cannot be indented.
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Not true, that header is a PHP function.  It is correct in your posted code.

I'm not sure what is causing the error you're getting but all of your 'if' and 'elseif' statements are wrong because a single '=' is an assignment, not a comparison.  Should be:

if ($hiddest == 'contact')

Open in new window


figured out what I was missing

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial