How to Fix Joomla Error: Could Not Instantiate Mail Function

The “Could Not Instantiate Mail Function” error is a frequently seen problem for Joomla sites allowing users to register or contact the site administrators. There are many possible reasons for the error message to appear, and this tutorial offers some of the solutions that can help most users out.

Due to different server settings of different Joomla web hosts, you may need to ask your hosting provider to help if the tips discussed below cannot help.

Check the Mail Settings

It is possible that the email failure is caused by incorrect mail settings. To check out the configurations, log into Joomla control panel and go to System > Global Configuration. Click on the Server tab and find the “Mail Settings” section.

Mail Settings

Firstly, you have to make sure that “Send Mail” is set to “Yes”. Then, check the settings for different mailer types based on the following suggestions.

PHP Mail

Make sure that you have entered a valid email address for “From email”. It is suggested to use a site admin email that is served by the same server as your Joomla site. A different email address hosted elsewhere may cause trouble.

Besides, as PHP Mail uses the php mail() function to send emails but some servers may not support the function, you’d better contact your hosting provider for a consultation. If this function is not supported, you have to turn to other mailers.

Also, in the case that you are setting up Joomla on a local server, you should not use PHP Mail as some local servers do not allow sending emails with php mail() function by default.

PHP Mail


Using Sendmail, you are sending emails with a direct path. For this mailer type, the requirement for “From email” is the same as PHP Mail. No other settings need to be taken care of.

However, as Sendmail may require you to make some configurations, this mail type is not recommended if you are not very familiar Joomla settings.



SMTP is much more flexible than the other two options as it not only allows using the mail server of your hosting provider, but also gives support to third-party SMTP servers like Gmail. SMTP is highly recommended if your server does not support php mail() function or receives the “Could Not Instantiate Mail Function” error frequently.

Set up SMTP to Send Joomla Emails

Assumed that you have already prepared an email account and an SMTP server (either from your hosting provider or Gmail), now complete the SMTP settings with the information below.

  • From email: Your email account.
  • From name: Your site name or anything else.
  • SMTP Authentication: Set to “Yes”.
  • SMTP Security: SSL/TLS, depending on the configuration of your hosting provider or the third-party SMTP server. Gmail provides SSL.
  • SMTP Port: Enter the SSL/TLS port required for the SMTP server. You may need to contact your hosting provider for the correct information. And for Gmail, the port number is 465/587.
  • SMTP Username & SMTP Password: Your email address and password.
  • SMTP Host: Keep the value to “localhost” if you are using the SMTP server of your hosting provider, or change it to “” if you are using Gmail.

Remember that the “Mail from” address should be on the same server that you use for SMTP. For instance, you need to use a Gmail account for “Mail from” if you set up the Gmail SMTP.

Look at the screenshots below to know the configurations in different situations. The former is for setting up SMTP with your hosting provider, and the latter is for Gmail.

Set Up SMTP to Send Joomla Emails