This question already has an answer here:
I am struggling to get PHPMailer setup and working in my application.
The installation seems simple enough. My directory structure looks like this:
|-[controllers] |---controller.php |-[vendor] |---[PHPMailer] |------class.phpmailer.php |------PHPMailerAutoload.php |-index.php
index.php
<?php ... require __DIR__ . '/vendor/PHPMailer/PHPMailerAutoload.php'; ... ?>
controller.php
<?php include('vendor/PHPMailer/class.phpmailer.php'); $mail = new PHPMailer(); ... ?>
That's pretty much as simple as the example gets, but when I run this, I get the following error:
Parse error: syntax error, unexpected end of file in C:\wamp\www\commway\vendor\PHPMailer\class.phpmailer.php on line 2995
Everything was working fine, I can't see how I've managed to break this. I have even tried moving everything to just the index.php
file but I get the same result. As soon as I call $mail = new PHPMailer();
it throws the error.