Could not instantiate mail function

Quick Fix
Check that this error isn't resolved by just changing the Mailer (Joomla > Global Configuration > Mailer settings). Alternate between PHPmail and sendmail just to check this isn't the problem. If the problem is still there then check the below:

Tried both PHPmail and sendmail
So if this happens irrespective of whether I have PHP mail or sendmail set as the Mailer.
Could not execute: /usr/sbin/sendmail
Registration failed: An error was encountered while sending the registration email. A message has been sent to the administrator of this site.
  1.  Notice 
  2.  Could not execute: /usr/sbin/sendmail 
  3.  Warning 
  4.  Registration failed: An error was encountered while sending the registration email. A message has been sent to the administrator of this site. 
Check you can send email from that server
Message not sent. Server replied:
Connection refused
111 Can't open SMTP stream.
  1.  ERROR: 
  2.  Message not sent. Server replied: 
  3.  Connection refused 
  4.  111 Can't open SMTP stream. 

One common problem people have is an incorrectly setup mail system. Here is a list of rules that must be followed:
I took this from Direct Admin but it has some useful guidelines for these kind of issues:

How to setup the Mail System

1) hostname must not match any domain that is being used on the system. Example, if you have a domain called and you want to recieve mail on This email address is being protected from spambots. You need JavaScript enabled to view it., you must *not* set your hostname to We recommend using instead. You must make sure that you add the A record for so that it resolves.

2) The hostname must be in the /etc/virtual/domains file.

3) The hostname must *not* be in the /etc/virtual/domainowners file.

4) The hostname must resolve. If not, add the required A records to the dns zone such that it does.

5) The directory /etc/virtual/hostname must exist.. (eg: /etc/virtual/ It must not contain any files.

6) Any domains that you want to use for email (eg: must be in both the /etc/virtual/domains file and the /etc/virtual/domainowners file. The directory /etc/virtual/ must exist and the files /etc/virtual/ and /etc/virtual/ exist.

7) File permissions for virtual pop inboxes should be (not applicable with Dovecot/Maildir):
/var/spool/virtual/ 770 username:mail
/var/spool/virtual/* 660 username:mail

8) Ensure your hostname does not contain any upper case letters.

9) Make sure that your main server IP has a reverse lookup on it.
Category: Joomla :: Article: 358

Credit where Credit is Due:

Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman

Related Articles

Joes Revolver Map

Joes Word Cloud


Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Donate to Joel Lipman via PayPal

Donate to Joel Lipman with Bitcoin bc1qf6elrdxc968h0k673l2djc9wrpazhqtxw8qqp4

Donate to Joel Lipman with Ethereum 0xb038962F3809b425D661EF5D22294Cf45E02FebF
© 2024 Joel Lipman .com. All Rights Reserved.