jerror Could not instantiate mail function Topic is solved

Need help with the Administration of your Joomla! 4.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Locked
penraeth
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Fri Nov 07, 2014 7:15 pm

jerror Could not instantiate mail function

Post by penraeth » Sat Jan 21, 2023 3:19 am

In site configuration I can successfully send test emails via all three sending options, and some extensions are able to send emails. But when registering a new account, I get a "Could not instantiate mail function" system warning and no account related emails are sent.

Looking at the everything log isn't much help to me. Looks like it's using sendmail even when PHP or SMTP are configured, which seems odd. I'm at a loss as to how to get more information about this: checked server error log, debug is turned on at maximum. Anyone have a clue ???

Error in Mail API: Result: false
Error in Mail API: Could not instantiate mail function.
Error in Mail API: Sending with mail()
Error in Mail API: Sendmail path: /usr/sbin/sendmail -t -i
Error in Mail API: Envelope sender:
Error in Mail API: To: "[email protected]" <[email protected]>
Error in Mail API: Subject: Account Details for xxx at xxx
Error in Mail API: Headers: Date: Sat, 21 Jan 2023 02:00:35 +0000

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17435
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: jerror Could not instantiate mail function

Post by toivo » Sat Jan 21, 2023 5:00 am

penraeth wrote:
Sat Jan 21, 2023 3:19 am
In site configuration I can successfully send test emails via all three sending options
The test emails are sent to the email address specified in the field 'From Email', which is most likely in the same domain as the web server. The registration emails come from different email domains. Your host may have restricted the web server from connecting directly to external mail servers.

penraeth wrote:
Sat Jan 21, 2023 3:19 am
Looks like it's using sendmail even when PHP or SMTP are configured, which seems odd.
Joomla uses the PHPMailer library and if one mailer option does not work, it may try the next one.

Contact your host and find out where they want your Joomla site to connect for sending emails. They may want all the servers to forward emails to their own mail server.
Toivo Talikka, Global Moderator

penraeth
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Fri Nov 07, 2014 7:15 pm

Re: jerror Could not instantiate mail function

Post by penraeth » Mon Jan 23, 2023 3:44 pm

toivo wrote:
Sat Jan 21, 2023 5:00 am
The registration emails come from different email domains.
Thanks for the idea toivo, but if the registration emails are not sent from the address specified in global configuration/server/from email, then what domain would be used?

I'll ask Siteground about it anyway.

penraeth
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Fri Nov 07, 2014 7:15 pm

Re: jerror Could not instantiate mail function

Post by penraeth » Mon Jan 23, 2023 4:26 pm

Siteground found nothing off on the server side.

Today, oddly, the warning and log looks different. "Could not execute: /usr/sbin/sendmail"

It may be unrelated, but I'm getting a load of these errors

2023-01-23T16:11:56+00:00 CRITICAL 167.172.51.102 error Uncaught Throwable of type Joomla\CMS\Router\Exception\RouteNotFoundException thrown with message "Page not found". Stack trace: #0 [ROOT]/libraries/src/Application/SiteApplication.php(736): Joomla\CMS\Router\Router->parse(Object(Joomla\CMS\Uri\Uri), true)
#1 [ROOT]/libraries/src/Application/SiteApplication.php(224): Joomla\CMS\Application\SiteApplication->route()
#2 [ROOT]/libraries/src/Application/CMSApplication.php(294): Joomla\CMS\Application\SiteApplication->doExecute()
#3 [ROOT]/includes/app.php(61): Joomla\CMS\Application\CMSApplication->execute()
#4 [ROOT]/index.php(32): require_once('/home/customer/...')
#5 {main}

penraeth
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Fri Nov 07, 2014 7:15 pm

Re: jerror Could not instantiate mail function

Post by penraeth » Mon Jan 23, 2023 4:34 pm

penraeth wrote:
Mon Jan 23, 2023 4:26 pm
Today, oddly, the warning and log looks different. "Could not execute: /usr/sbin/sendmail"
Nevermind, that was just a difference in debuging on vs off. And that other error is not happening at the same time.

Any idea on how I can test to get more information?

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17435
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: jerror Could not instantiate mail function

Post by toivo » Mon Jan 23, 2023 8:27 pm

penraeth wrote:
Mon Jan 23, 2023 3:44 pm
toivo wrote:
Sat Jan 21, 2023 5:00 am
The registration emails come from different email domains.
Sorry, I should have said "The registration email addresses come from different email domains." Therefore, if the mail server controlled by your host does not allow emails to be sent to those other domains, the mail functions in the PHPMailer library report an error.

I'd say that the ball is still in your host's court. They should give you the preferred mailer selection or SMTP settings and configure their SMTP forwarding server or egress firewall accordingly.
Toivo Talikka, Global Moderator

penraeth
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Fri Nov 07, 2014 7:15 pm

Re: jerror Could not instantiate mail function

Post by penraeth » Mon Jan 23, 2023 8:42 pm

Thanks for sticking with me master Toivo

Siteground has no issue sending TO any address, if that's what you're saying. In fact, most of my attempts have used addresses hosted by Siteground.

In addition to "send test email" always working, I can use the Membership Pro extension to import subscribers, which creates a new joomla user and sends an email with their registration details. Username / password reminder emails are also sent successfully. Seems like these would both use the same functions as registering.

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17435
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: jerror Could not instantiate mail function

Post by toivo » Mon Jan 23, 2023 9:00 pm

penraeth wrote:
Mon Jan 23, 2023 8:42 pm
Seems like these would both use the same functions as registering.
That is usually the case with third party extensions. They use the mailer selection and mail configuration of Joomla. Some extension may install their own version of the PHPMailer library and use their own configuration, different from Joomla.

penraeth wrote:
Mon Jan 23, 2023 8:42 pm
Username / password reminder emails are also sent successfully.
Is everything working now or are there still errors?
Toivo Talikka, Global Moderator

penraeth
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Fri Nov 07, 2014 7:15 pm

Re: jerror Could not instantiate mail function

Post by penraeth » Wed Jan 25, 2023 12:13 am

toivo wrote:
Mon Jan 23, 2023 9:00 pm
Is everything working now or are there still errors?
.... still errors

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17435
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: jerror Could not instantiate mail function

Post by toivo » Wed Jan 25, 2023 2:45 am

Please turn on the Debug option and post the messages here.
Toivo Talikka, Global Moderator

penraeth
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Fri Nov 07, 2014 7:15 pm

Re: jerror Could not instantiate mail function

Post by penraeth » Wed Jan 25, 2023 3:32 pm

There's nothing about it in the debug output. There's no stack trace. Just a warning and an alert.

Could not execute: /usr/sbin/sendmail
An error was encountered while sending activation notification email

I could share the queries or the session data, or the profile?

Code: Select all

afterLoad (4.7MB) (6.8ms)
afterInitialise (8.6MB) (32.46ms)
Before Access::preloadComponents (all components) (3.23MB) (7.01ms)
After Access::preloadComponents (all components) (118.62KB) (1.39ms)
Before Access::getAssetRules (id:1 name:root.1) (3.63KB) (27μs)
After Access::getAssetRules (id:1 name:root.1) (9.11KB) (161μs)
afterRoute (1.33KB) (121μs)
beforeRenderComponent com_users (20.41KB) (497μs)
afterRenderComponent com_users (3.11MB) (15.75ms)
afterDispatch (3.58KB) (259μs)
afterRender (1.73MB) (21.52ms)
1 x afterInitialise (8.6MB) (34.06%)	
32.46ms
1 x afterRender (1.73MB) (22.58%)	
21.52ms
1 x afterRenderComponent com_users (3.11MB) (16.53%)	
15.75ms
1 x Before Access::preloadComponents (all components) (3.23MB) (7.35%)	
7.01ms
1 x afterLoad (4.7MB) (7.13%)	
6.80ms
1 x After Access::preloadComponents (all components) (118.62KB) (1.46%)	
1.39ms
1 x beforeRenderComponent com_users (20.41KB) (0.52%)	
497μs
1 x afterDispatch (3.58KB) (0.27%)	
259μs
1 x After Access::getAssetRules (id:1 name:root.1) (9.11KB) (0.17%)	
161μs
1 x afterRoute (1.33KB) (0.13%)	
121μs
1 x Before Access::getAssetRules (id:1 name:root.1) (3.63KB) (0.03%)	
27μs

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17435
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: jerror Could not instantiate mail function

Post by toivo » Thu Jan 26, 2023 12:47 am

penraeth wrote:
Wed Jan 25, 2023 3:32 pm
Could not execute: /usr/sbin/sendmail
An error was encountered while sending activation notification email
If the mailer option Sendmail does not work and the host is unable to fix it, do not use it. Use the PHP Mail option, which an SMTP mail server configured by your host in the php.ini file, or the mailer SMTP, which you have to configure yourself, assuming that your host allows the web server to forward mail to an external SMTP server.
Toivo Talikka, Global Moderator

penraeth
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Fri Nov 07, 2014 7:15 pm

Re: jerror Could not instantiate mail function

Post by penraeth » Thu Jan 26, 2023 3:02 pm

Okay, I'll restate my issue again more explicitly

In Joomla! 4.2.6 / global configuration/server/mail I can successfully configure and send test emails via all three sending options: PHP mail, Sendmail and SMTP.

Regardless of which I use, when the Joomla registration form is completed I get the warning and alert:

Could not execute: /usr/sbin/sendmail
An error was encountered while sending activation notification email

I've previously described that OTHER emails ARE being sent by Joomla. See above for details.

And you say if Joomla! can't send via the configured method, it tries another. Not here: the error logs always show sendmail and nothing else. So maybe it falls back to sendmail even when sendmail is configured, or not, but it hardly matters. Again, all three methods are configured properly and fully functional. The web host is NOT blocking anything. It's something in Joomla! that isn't working.

penraeth
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Fri Nov 07, 2014 7:15 pm

Re: jerror Could not instantiate mail function

Post by penraeth » Thu Jan 26, 2023 3:08 pm

AND I can't get any more information about the issue out of Joomla!

There's nothing in the debug out put. There's a few lines in the Joomla! error logs, already shared above. That's all I got.

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17435
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: jerror Could not instantiate mail function

Post by toivo » Thu Jan 26, 2023 9:28 pm

Are there any third party extensions involved in the registration process?

penraeth wrote:
Sat Jan 21, 2023 3:19 am
Looks like it's using sendmail even when PHP or SMTP are configured, which seems odd.
As you originally said, it seems really odd. What happens if you try to use Gmail as SMTP server, by following this tutorial: How do I use Gmail as my mail server? The SMTP mailer is not expected to start using sendmail in the web server.
Toivo Talikka, Global Moderator

penraeth
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Fri Nov 07, 2014 7:15 pm

Re: jerror Could not instantiate mail function

Post by penraeth » Fri Jan 27, 2023 4:05 pm

DUDE!!
*sigh*

For smtp I was using localhost instead of the smtp server, which I'm guessing only works on the backend.

So, freakin problem solved!

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17435
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: jerror Could not instantiate mail function

Post by toivo » Fri Jan 27, 2023 8:30 pm

Ok, that explains it. Thank you for the update!
Toivo Talikka, Global Moderator


Locked

Return to “Administration Joomla! 4.x”