Hi,
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!
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!
Last edited by psytanium on Sat Jul 26, 2025 12:08 am, edited 1 time in total.
What is your opencart version?
btw you can do something like this to get more details on Exception
system/library/mail/smtp.php
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
Legendary Member
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
Legendary Member
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.']');
I changed the smtp.php to:
I didn't add this line, because I don't know where should I add :
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!');
When I checkout or anything that trigger sending our emails, I got this error:
This is what I found in line 91:
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 . ')');
An error on line 91 could suggest an issue with connecting to the hostname and port. What settings are you using?
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
Try reentering the settings in case there is some error you can't see such as special character. Use ssl:// with port 465 or tls:// with port 587.
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.
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.
Who is online
Users browsing this forum: No registered users and 19 guests