JFACTORY-GETMAILER-001

JFactory::getMailer()

Factory::getMailer()

getMailer() is deprecated since 4.4. Mail is a container service. Exceptions now bubble — wrap send() in try/catch.

JFactory::getMailer()Mailer from the container

Dies at Joomla 4 → 5J3: Works nativelyJ4: Deprecated — do not shipJ6: Deprecated — do not shipBC plugin: not applicablePatch possible — review itJoomla API

What you will see

  • Factory::getMailer is deprecated

Symptoms people search

mail send fatal instead of silent fail

Replace this code

Swap JFactory::getMailer() for Mailer from the container.

Joomla 3

Remove or stop calling this

$mailer = JFactory::getMailer();

Joomla 4 / 6

Use this instead

$mailer = Factory::getContainer()->get(\Joomla\CMS\Mail\MailerFactoryInterface::class)->createMailer();

How to fix it

  1. 1Resolve the mailer from the container.
  2. 2Catch MailDisabledException.

Also known as

getMailer

Related issues

Get in touch

Have a project in mind? Let's talk about it.

Tell us what you're building. Whether it's a new site, an online store, a mobile app, or something that needs AI under the hood, we'll get back to you within a business day.

Free consultation
No commitment, no pressure
Reply within 24 hours
Usually much faster

Prefer a direct conversation?

Request a project quote

Tell us about your project

Fill out the quick form and we'll reach out.