New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Very initial documentation doesn't seem to be accurate #2297
Comments
Which version of PHP are you using? Also check #1142 |
Very easily, by using a version of PHP that's so ancient (< 5.3) that it doesn't support namespaces... PHPMailer 6.x requires a minimum of PHP 5.5, as also stated in the docs. Also the example code has these lines in a different order; the convention is to put |
Uh, why have you closed this? This hasn't been resolved.... My PHP Version is actually 7.4, so no idea what you're talking about there. And the ordering, they were originally in the order you gave but that showed the issue (so I assumed it because your documentation was wrong and they needed declaring first - which would make sense). But that hasn't fixed it, apologies for that. Can you re-open this and provide some more info for me please? Just closing the ticket is not very helpful at all. I have a genuine issue here where I believe your documentation to be either wrong, or unhelpful. Just closing the issue is a slap in the face and not really the response I expected when asking for help. |
For what it's worth, I ditched your code because it doesn't work, and went looking elsewhere. Glad I did now seeing your level of willingness (or not) to help those who ask for help. Take care of yourself. |
The error you're seeing means you have a syntax error somewhere in your own scripts. What the docs say is correct. If it's only an IDE error, it could be that your IDE is set to use the wrong language level. Asserting that maintainers don't know how to write basic PHP syntax, and insulting their code and documentation isn't a great way to make us want to help you. You're clearly very new to PHP, and the issue you're describing is most likely explained exactly as I said – that you're running an old version of PHP. As such, this is not a PHPMailer problem, so I closed the issue, on which you can still comment. If you're running PHP 7.4, this (and just this) should run without error (assuming paths are correct): <?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'phpmailer/src/Exception.php';
require 'phpmailer/src/PHPMailer.php';
require 'phpmailer/src/SMTP.php';
echo PHP_VERSION; //for good measure If you get that same
|
So as per the instructions if you're not using Composer suggest, I have pointed to the require files and included the 'use' lines as instructed:
However, My editor is flagging this as a syntax error, and sure the PHP page doesn't run stating this:
Parse error: syntax error, unexpected 'use' (T_USE)
How can this go wrong at the very first step? There's something wrong with your documentation I';m sure.
Please help ASAP, I shouldn't be having problems with the very first few lines!
The text was updated successfully, but these errors were encountered: