I’m trying to send notification emails using an Office 365 SMTP account, but I keep getting an error every time I confirm a purchase on the checkout page. Please see the attached screenshot of the error message.
I’ve also attached a screenshot of my OpenCart mail settings configuration.
I’ve double-checked that the username and password are correct by logging in directly at outlook.com, so the credentials work. Also I tried port 465 and SSL://
Has anyone faced this before? Any ideas what I might be missing?
Im using OC3.0.3.8
Thank you!
btw you can do something like this to get more details on Exception
system/library/mail/smtp.php
Code: Select all
throw new \Exception('Error: EHLO not accepted from server'."\n".'['.$reply.']');
Got a burning question at 3 AM that even Google shrugs at? There’s a not-so-secret inbox that might just have your answer: khnaz35@gmail.com
Breathe in some nature while you're at it. It’s cheaper than therapy.
Feel free to sling a bear my way via PayPal @ khnaz35@gmail.com
Where do i add / replace this line of code ? Im using Opencart 3.0.8.0khnaz35 wrote: ↑Fri Jul 25, 2025 10:16 pmWhat is your opencart version?
btw you can do something like this to get more details on Exception
system/library/mail/smtp.phpCode: Select all
throw new \Exception('Error: EHLO not accepted from server'."\n".'['.$reply.']');
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
This has been answered many times before: viewtopic.php?t=231301psytanium wrote: ↑Sat Jul 26, 2025 3:10 pmCode: Select all
throw new \Exception('Error: EHLO not accepted from server'."\n".'['.$reply.']');
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Thank you for your reply. Ill try thatpaulfeakins wrote: ↑Wed Jul 30, 2025 5:48 pmThis has been answered many times before: viewtopic.php?t=231301psytanium wrote: ↑Sat Jul 26, 2025 3:10 pmCode: Select all
throw new \Exception('Error: EHLO not accepted from server'."\n".'['.$reply.']');
Code: Select all
if (substr($reply, 0, 3) != 250) {
throw new \Exception('Error: EHLO not accepted from server!');
}
if (substr($this->smtp_hostname, 0, 3) == 'tls') {
fputs($handle, 'STARTTLS' . "\r\n");
$this->handleReply($handle, 220, 'Error: STARTTLS not accepted from server!');
if (stream_socket_enable_crypto($handle, true, STREAM_CRYPTO_METHOD_TLS_CLIENT) !== true) {
throw new \Exception('Error: TLS could not be established!');
}
fputs($handle, 'EHLO ' . getenv('SERVER_NAME') . "\r\n");
$this->handleReply($handle, 250, 'Error: EHLO not accepted from server!');
}
Code: Select all
throw new \Exception('Error: EHLO 1 not accepted from server!');
Code: Select all
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
parsererror
<br />
<b>Fatal error</b>: Uncaught Exception: Error: (0) in /home/user/public_html/system/library/mail/smtp.php:91
Stack trace:
#0 /home/user/public_html/system/library/mail.php(142): Mail\Smtp->send()
#1 /home/user/storage/modification/catalog/controller/mail/order.php(302): Mail->send()
#2 /home/user/storage/modification/catalog/controller/mail/order.php(34): ControllerMailOrder->add(Array, '1', '', '')
#3 /home/user/storage/modification/system/engine/action.php(79): ControllerMailOrder->index('checkout/order/...', Array)
#4 /home/user/public_html/system/engine/event.php(62): Action->execute(Object(Registry), Array)
#5 /home/user/storage/modification/system/engine/loader.php(229): Event->trigger('model/checkout/...', Array)
#6 /home/user/public_html/system/engine/proxy.php(47): Loader->{closure}(Array, Array)
#7 /home/user/public_html/catalog/controller/extension/payment/cod.php(13): Proxy->__call('addOrderHistory', Array)
#8 /home/istuserknon/storage/modification/system/engine/action.php(79): Contr in <b>/home/istiknon/public_html/system/library/mail/smtp.php</b> on line <b>91</b><br />
Code: Select all
throw new \Exception('Error: ' . $errstr . ' (' . $errno . ')');
Mail Engine : SMTPADD Creative wrote: ↑Tue Aug 26, 2025 3:37 pmAn error on line 91 could suggest an issue with connecting to the hostname and port. What settings are you using?
Mail Parameters: empty
SMTP Hostname: ssl://smtp.office365.com also tried tls://smtp.office365.com
SMTP Username: contact@domainname.com
SMTP Password: ***
SMTP Port: 465 / also tried 587
SMTP Timeout: 5 also tried long, 60
Find and look in you PHP error log as well as the OpenCart one.
If you still get "Uncaught Exception: Error: (0) in /home/user/public_html/system/library/mail/smtp.php:91", try asking your host.
Got a burning question at 3 AM that even Google shrugs at? There’s a not-so-secret inbox that might just have your answer: khnaz35@gmail.com
Breathe in some nature while you're at it. It’s cheaper than therapy.
Feel free to sling a bear my way via PayPal @ khnaz35@gmail.com
- SMTP Host Name: smtp.office365.com
- Port: 587 (recommended for secure communication)
- Encryption Method: TLS or STARTTLS
- Authentication: Enabled, using your full Office 365 email address and its password
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
I’ve attached screenshots of my OpenCart (Version 3.0.3.8, PHP 7.3) Settings > Mail, as well as a screenshot of the mail routing in cPanel.JNeuhoff wrote: ↑Wed Sep 03, 2025 12:03 amThese are the SMTP settings to be used for Office365:
And they should be reflected in the OpenCart's System > Settings > Mail .
- SMTP Host Name: smtp.office365.com
- Port: 587 (recommended for secure communication)
- Encryption Method: TLS or STARTTLS
- Authentication: Enabled, using your full Office 365 email address and its password
Our employees can use their Microsoft 365 emails without issues, but the website is unable to send emails.
I’ve also attached a screenshot of the error that occurs when the website attempts to send emails.
This problem took so long, hope i can get some help.
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Users browsing this forum: No registered users and 30 guests