Email broken, breaking other modules

Not sure exactly when this started but it seems that any trigger in Dolibarr that sends email is giving me HTTP ERROR 500.

  • If I test server connectivity under Setup > Emails it says server is available on port 25
  • If I try and test sending email under Setup → Emails I get HTTP ERROR 500.
  • If I try and create a record, like a new ticket, I get HTTP Error 500.
  • If I turn email off under Setup > Emails, I can create a ticket normally.

Email is setup using SMTP/SMTPS and has had the same config since I started using Dolibarr a few years back. Email used to work just fine.

Here are the errors in Apache when trying to test email sending:
[Tue Sep 05 12:58:24.763748 2023] [php:warn] [pid 38] [client 172.20.255.4:39126] PHP Warning: Undefined property: stdClass::$MAIN_MAIL_SMTPS_ID in /var/www/html/admin/mails.php on line 726, referer: https://www.mydolibarr.com/admin/mails.php?action=testconnect&date=1693936414

[Tue Sep 05 12:58:24.763785 2023] [php:warn] [pid 38] [client 172.20.255.4:39126] PHP Warning: Undefined property: stdClass::$MAIN_MAIL_SMTPS_PW in /var/www/html/admin/mails.php on line 731, referer: https://www.mydolibarr.com/admin/mails.php?action=testconnect&date=1693936414

172.20.255.4 - - [05/Sep/2023:12:58:24 -0500] “GET /admin/mails.php?action=test&mode=init HTTP/1.1” 200 13706 “https://www.mydolibarr.com/admin/mails.php?action=testconnect&date=1693936414” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36”

172.20.255.4 - - [05/Sep/2023:12:58:27 -0500] “POST /core/ajax/check_notifications.php HTTP/1.1” 200 409 “https://www.mydolibarr.com/admin/mails.php?action=test&mode=init” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36”

[Tue Sep 05 12:58:31.385386 2023] [php:error] [pid 41] [client 172.20.255.4:42254] PHP Fatal error: Uncaught Error: Call to undefined function getDomainFromURL() in /var/www/html/core/class/smtps.class.php:697\nStack trace:\n#0 /var/www/html/core/class/CMailFile.class.php(1004): SMTPs->sendMsg()\n#1 /var/www/html/core/actions_sendmails.inc.php(372): CMailFile->sendfile()\n#2 /var/www/html/admin/mails.php(140): include(‘…’)\n#3 {main}\n thrown in /var/www/html/core/class/smtps.class.php on line 697, referer: https://www.mydolibarr.com/admin/mails.php?action=test&mode=init

172.20.255.4 - - [05/Sep/2023:12:58:31 -0500] “POST /admin/mails.php HTTP/1.1” 500 305 “https://www.mydolibarr.com/admin/mails.php?action=test&mode=init” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36”

[Tue Sep 05 12:58:33.537300 2023] [php:warn] [pid 40] [client 172.20.255.4:42270] PHP Warning: Undefined property: stdClass::$MAIN_MAIL_SMTPS_ID in /var/www/html/admin/mails.php on line 726, referer: https://www.mydolibarr.com/admin/mails.php?action=testconnect&date=1693936414

[Tue Sep 05 12:58:33.537329 2023] [php:warn] [pid 40] [client 172.20.255.4:42270] PHP Warning: Undefined property: stdClass::$MAIN_MAIL_SMTPS_PW in /var/www/html/admin/mails.php on line 731, referer: https://www.mydolibarr.com/admin/mails.php?action=testconnect&date=1693936414

172.20.255.4 - - [05/Sep/2023:12:58:33 -0500] “GET /admin/mails.php?action=test&mode=init HTTP/1.1” 200 13705 “https://www.mydolibarr.com/admin/mails.php?action=testconnect&date=1693936414” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36”

172.20.255.4 - - [05/Sep/2023:12:58:36 -0500] “POST /core/ajax/check_notifications.php HTTP/1.1” 200 409 “https://www.mydolibarr.com/admin/mails.php?action=test&mode=init” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36”

Here is the errors in my Apache log when trying to create a ticket:

[Tue Sep 05 12:41:07.904279 2023] [php:error] [pid 36] [client 172.20.255.4:41688] PHP Fatal error: Uncaught Error: Call to undefined function getDomainFromURL() in /var/www/html/core/class/smtps.class.php:697\nStack trace:\n#0 /var/www/html/core/class/CMailFile.class.php(1004): SMTPs->sendMsg()\n#1 /var/www/html/core/triggers/interface_50_modTicket_TicketEmail.class.php(353): CMailFile->sendfile()\n#2 /var/www/html/core/triggers/interface_50_modTicket_TicketEmail.class.php(184): InterfaceTicketEmail->composeAndSendAdminMessage()\n#3 /var/www/html/core/class/interfaces.class.php(183): InterfaceTicketEmail->runTrigger()\n#4 /var/www/html/core/class/commonobject.class.php(5790): Interfaces->run_triggers()\n#5 /var/www/html/ticket/class/ticket.class.php(569): CommonObject->call_trigger()\n#6 /var/www/html/ticket/card.php(244): Ticket->create()\n#7 {main}\n thrown in /var/www/html/core/class/smtps.class.php on line 697, referer: https://www.mydolibarr.com/ticket/card.php
172.20.255.4 - -

[05/Sep/2023:12:41:07 -0500] “POST /ticket/card.php HTTP/1.1” 500 305 “https://www.mydolibarr.com/ticket/card.php” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36”

[Tue Sep 05 12:41:12.713766 2023] [php:warn] [pid 38] [client 172.20.255.4:41692] PHP Warning: Attempt to read property “code_client” on string in /var/www/html/core/modules/ticket/mod_ticket_universal.php on line 141, referer: https://www.mydolibarr.com/ticket/index.php?mainmenu=ticket&leftmenu=
172.20.255.4 - -

[05/Sep/2023:12:41:12 -0500] “GET /ticket/card.php?action=create&idmenu=1512&mainmenu=ticket&leftmenu= HTTP/1.1” 200 15652 “https://www.mydolibarr.com/ticket/index.php?mainmenu=ticket&leftmenu=” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36”
172.20.255.4 - -

[05/Sep/2023:12:41:16 -0500] “POST /core/ajax/check_notifications.php HTTP/1.1” 200 409 “https://www.mydolibarr.com/ticket/card.php?action=create&idmenu=1512&mainmenu=ticket&leftmenu=” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36”

Hello,

This function is on

htdocs\core\lib\geturl.lib.php

Check if this file exists and if the content is OK

Thanks for responding. I have checked and the file appears to be there and shows what I assume is correct contents. No errors or issues displaying the file contents.

could this be the same issue?

Yes it is the same issue.