Home › Forums › Quform PHP › Fatal error: Uncaught. Is it the form or the 365 server?
- This topic has 15 replies, 3 voices, and was last updated 1 week, 2 days ago by
Ally.
- AuthorPosts
- December 2, 2025 at 4:43 pm #37945
fabydesign
ParticipantHello I have the following errors in trying to send form to Office 365.
I do not have access to MIcrosoft setting, the IT guy does. Before asking I need to know where the errors are coming from. Either a bad customization of the form/scripts (my bad) or the wrong info or bad setup from him (Office 365).
As follow:
Fatal error: Uncaught PHPMailer\PHPMailer\Exception: SMTP Error: Could not connect to SMTP host. Failed to connect to server in /home/xxxxx/public_html/quform/vendor/phpmailer/phpmailer/src/PHPMailer.php:2405
Stack trace:
#0 /home/xxxxx/public_html/quform/vendor/phpmailer/phpmailer/src/PHPMailer.php(2175): PHPMailer\PHPMailer\PHPMailer->smtpConnect()
#1 /home/xxxxx/public_html/quform/vendor/phpmailer/phpmailer/src/PHPMailer.php(1798): PHPMailer\PHPMailer\PHPMailer->smtpSend()
#2 /home/xxxxx/public_html/quform/vendor/phpmailer/phpmailer/src/PHPMailer.php(1615): PHPMailer\PHPMailer\PHPMailer->postSend()
#3 /home/xxxxx/public_html/quform/process-file-uploads-FR.php(427): PHPMailer\PHPMailer\PHPMailer->send()
#4 /home/xxxxx/public_html/quform/process-file-uploads-FR.php(479): process()
#5 {main}
thrown in /home/xxxxx/public_html/quform/vendor/phpmailer/phpmailer/src/PHPMailer.php on line 2405
Thank you.December 4, 2025 at 1:14 pm #37947Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
December 9, 2025 at 4:27 am #37955fabydesign
ParticipantHello Ally,
Just got back from talking to the host.
The server does not support OAuth 2.0 for SMTP authentication. OAuth 2.0 is handled on the Microsoft 365 side.
He said, use Microsoft 365’s own SMTP relay or API-based sending (Graph API), not the server’s SMTP service.
Remember that only the IT guy has access to 365.
What can I do on my end, if any?
What customization is possible with your script, if even possible.
Thank you very much.December 9, 2025 at 12:10 pm #37958Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
February 9, 2026 at 2:22 pm #38022fabydesign
ParticipantHello,
Back again at it.
I will get the info needed (client ID, Token etc.) today from the IT guy. I noticed there is a script hidden far in the vendor folder: get_oath_token.php.
Same I see in PHPMailer doc on GitHub. That means it can actually send through OAUTH2 connection, contrary of what you wrote earlier…Please explain?
Now how do I set it up (probably easy), and attach it to my form (process-file-uploads.php) using your scripts? There is no real indication for a non developer person in your docs.
Since OAUTH2 is the way to go in the very near future, I believe you have or are working on an updated scripts.
Thank you for the help. I am probably not the only one wondering how to make it work.February 10, 2026 at 10:04 am #38023Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
March 17, 2026 at 6:37 pm #38025fabydesign
ParticipantHello and thank you again for the answer above.
I have updated the forms (French and English) but I am missing the “refresh token”.
I asked the IT guy for it and his answer was : it is MY job to create it?!?
Lost again….
If I was to ask for a real support where you take care of it, I guess you know what I need by now, how would I do and how much will it cost me?
What will you need?
I have wasted way to much time and the client is getting upset.
Thank you.March 18, 2026 at 9:50 am #38026Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
March 24, 2026 at 3:44 pm #38030fabydesign
ParticipantHello again,
I had to install Composer first.
But now when I try to update the files in phpmailer using Composer (composer require greew/oauth2-azure-provider), I get all sort of errors and updated file:
Composer could not detect the root package (phpmailer/phpmailer) version, defaulting to ‘1.0.0’. See https://getcomposer.org/root-version
./composer.json has been updated
Composer could not detect the root package (phpmailer/phpmailer) version, defaulting to ‘1.0.0’. See https://getcomposer.org/root-version
Running composer update greew/oauth2-azure-provider
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
– phpmailer/phpmailer is present at version 1.0.0+no-version-set and cannot be modified by Composer
– Root composer.json requires roave/security-advisories dev-latest -> satisfiable by roave/security-advisories[dev-latest].
– roave/security-advisories dev-latest conflicts with phpmailer/phpmailer <6.5.You can also try re-running composer require with an explicit version constraint, e.g. “composer require greew/oauth2-azure-provider:*” to figure out if any version is installable, or “composer require greew/oauth2-azure-provider:^2.1” if you know which you need.
Installation failed, reverting ./composer.json to its original content.
It simply fails
Any idea?
Thank you.
March 25, 2026 at 11:22 am #38031Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
April 10, 2026 at 4:45 pm #38045fabydesign
ParticipantHello again,
I have done all that was required but now I get a 500 error from the server when I try the get_oauth_token.php script on line.
It just does not work.
A bit out of hope now….
Thanks,
FabriceAttachments:
You must be logged in to view attached files.April 13, 2026 at 9:26 am #38047Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
April 13, 2026 at 3:23 pm #38048fabydesign
ParticipantHello,
We are getting there!
I greatly appreciate you formidable help in the process.
I was able to retrieve the refresh token, it is really super long.
I copied it into the php files instead of ‘YOUR_REFRESH_TOKEN’
Now after trying the form, I get the following error:
<b>There was a problem</b>
Fatal error: Uncaught PHPMailer\PHPMailer\Exception: SMTP Error: Could not authenticate. in /home/xxxxx/public_html/quform/vendor/phpmailer/phpmailer/src/PHPMailer.php:2384
Stack trace:
#0 /home/xxxxx/public_html/quform/vendor/phpmailer/phpmailer/src/PHPMailer.php(2175): PHPMailer\PHPMailer\PHPMailer->smtpConnect()
#1 /home/xxxxx/public_html/quform/vendor/phpmailer/phpmailer/src/PHPMailer.php(1798): PHPMailer\PHPMailer\PHPMailer->smtpSend()
#2 /home/xxxxx/public_html/quform/vendor/phpmailer/phpmailer/src/PHPMailer.php(1615): PHPMailer\PHPMailer\PHPMailer->postSend()
#3 /home/xxxxx/public_html/quform/process-file-uploads.php(454): PHPMailer\PHPMailer\PHPMailer->send()
#4 /home/xxxxx/public_html/quform/process-file-uploads.php(533): process()
#5 {main}
thrown in /home/xxxxx/public_html/quform/vendor/phpmailer/phpmailer/src/PHPMailer.php on line 2384
Is that still related to authentification?
Thank youApril 16, 2026 at 11:23 am #38049Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- This reply was modified 2 weeks, 2 days ago by
Ally.
April 22, 2026 at 7:48 pm #38067fabydesign
ParticipantThank you very much.
Here it is:
[22-Apr-2026 18:32:46 UTC] Connection: opening to smtp.office365.com:587, timeout=300, options=array (
‘ssl’ =>
array (
‘cafile’ => ‘/home/XXXXXXXX/public_html/quform/vendor/composer/ca-bundle/src/../res/cacert.pem’,
),
)
[22-Apr-2026 18:32:46 UTC] Connection: opened
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “220 YT4PR01CA0473.outlook.office365.com Microsoft ESMTP MAIL Service ready at Wed, 22 Apr 2026 18:32:46 +0000 [08DE9DB652951421]”
[22-Apr-2026 18:32:46 UTC] SERVER -> CLIENT: 220 YT4PR01CA0473.outlook.office365.com Microsoft ESMTP MAIL Service ready at Wed, 22 Apr 2026 18:32:46 +0000 [08DE9DB652951421][22-Apr-2026 18:32:46 UTC] CLIENT -> SERVER: EHLO riopel.com
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-YT4PR01CA0473.outlook.office365.com Hello [2605:6f00:1234:700:1::110]”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-SIZE 157286400”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-PIPELINING”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-DSN”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-ENHANCEDSTATUSCODES”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-STARTTLS”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-8BITMIME”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-BINARYMIME”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-CHUNKING”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250 SMTPUTF8”
[22-Apr-2026 18:32:46 UTC] SERVER -> CLIENT: 250-YT4PR01CA0473.outlook.office365.com Hello [2605:6f00:1234:700:1::110]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8[22-Apr-2026 18:32:46 UTC] CLIENT -> SERVER: STARTTLS
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “220 2.0.0 SMTP server ready”
[22-Apr-2026 18:32:46 UTC] SERVER -> CLIENT: 220 2.0.0 SMTP server ready[22-Apr-2026 18:32:46 UTC] CLIENT -> SERVER: EHLO riopel.com
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-YT4PR01CA0473.outlook.office365.com Hello [2605:6f00:1234:700:1::110]”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-SIZE 157286400”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-PIPELINING”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-DSN”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-ENHANCEDSTATUSCODES”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-AUTH LOGIN XOAUTH2”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-8BITMIME”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-BINARYMIME”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250-CHUNKING”
[22-Apr-2026 18:32:46 UTC] SMTP INBOUND: “250 SMTPUTF8”
[22-Apr-2026 18:32:46 UTC] SERVER -> CLIENT: 250-YT4PR01CA0473.outlook.office365.com Hello [2605:6f00:1234:700:1::110]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-AUTH LOGIN XOAUTH2
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8[22-Apr-2026 18:32:46 UTC] Auth method requested: XOAUTH2
[22-Apr-2026 18:32:46 UTC] Auth methods available on the server: LOGIN,XOAUTH2
[22-Apr-2026 18:32:47 UTC] CLIENT -> SERVER: AUTH XOAUTH2[22-Apr-2026 18:32:47 UTC] SMTP INBOUND: “334”
[22-Apr-2026 18:32:47 UTC] SERVER -> CLIENT: 334[22-Apr-2026 18:32:47 UTC] CLIENT -> SERVER: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXETC.
[22-Apr-2026 18:32:52 UTC] SMTP INBOUND: “535 5.7.3 Authentication unsuccessful [YT4PR01CA0473.CANPRD01.PROD.OUTLOOK.COM 2026-04-22T18:32:52.586Z 08DE9DB652951421]”
[22-Apr-2026 18:32:52 UTC] SERVER -> CLIENT: 535 5.7.3 Authentication unsuccessful [YT4PR01CA0473.CANPRD01.PROD.OUTLOOK.COM 2026-04-22T18:32:52.586Z 08DE9DB652951421][22-Apr-2026 18:32:52 UTC] SMTP ERROR: OAuth TOKEN command failed: 535 5.7.3 Authentication unsuccessful [YT4PR01CA0473.CANPRD01.PROD.OUTLOOK.COM 2026-04-22T18:32:52.586Z 08DE9DB652951421]
[22-Apr-2026 18:32:52 UTC] SMTP Error: Could not authenticate.
[22-Apr-2026 18:32:52 UTC] CLIENT -> SERVER: QUIT[22-Apr-2026 18:32:52 UTC] SMTP INBOUND: “221 2.0.0 Service closing transmission channel”
[22-Apr-2026 18:32:52 UTC] SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel[22-Apr-2026 18:32:52 UTC] Connection: closed
[22-Apr-2026 18:32:52 UTC] SMTP Error: Could not authenticate.
[22-Apr-2026 18:32:52 UTC] PHP Fatal error: Uncaught PHPMailer\PHPMailer\Exception: SMTP Error: Could not authenticate. in /home/XXXXXXXX/public_html/quform/vendor/phpmailer/phpmailer/src/PHPMailer.php:2384
Stack trace:
#0 /home/XXXXXXXX/public_html/quform/vendor/phpmailer/phpmailer/src/PHPMailer.php(2175): PHPMailer\PHPMailer\PHPMailer->smtpConnect()
#1 /home/XXXXXXXX/public_html/quform/vendor/phpmailer/phpmailer/src/PHPMailer.php(1798): PHPMailer\PHPMailer\PHPMailer->smtpSend()
#2 /home/XXXXXXXX/public_html/quform/vendor/phpmailer/phpmailer/src/PHPMailer.php(1615): PHPMailer\PHPMailer\PHPMailer->postSend()
#3 /home/XXXXXXXX/public_html/quform/process-file-uploads.php(456): PHPMailer\PHPMailer\PHPMailer->send()
#4 /home/XXXXXXXX/public_html/quform/process-file-uploads.php(537): process()
#5 {main}
thrown in /home/XXXXXXXX/public_html/quform/vendor/phpmailer/phpmailer/src/PHPMailer.php on line 2384 - This reply was modified 2 weeks, 2 days ago by
- AuthorPosts
- You must be logged in to reply to this topic.
