0

When a user clicks email icon in frontend article, a default message is sent giving the article link. But I want to modify this, and also send Article title and Introtext in the email.

  • For this, I created override of COM_MAILTO_EMAIL_MSG in languages/en-GB.com_mailto.ini.
  • In components/com_mailto/controller.php, set the email html content to true. But, I am not able to pass the article's id,title and introtext in the mail function which can be used in language file as dynamic parameters.
  • Here, only article link is available.

Edit -- This is the core modification, therefore for this, I created a system override plugin as mentioned here:

https://docs.joomla.org/How_to_override_the_component_mvc_from_the_Joomla!_core#Summary

I created a mailtooverridecontroller.php but here and copied the code of the components/com_mailto/controller.php but now I am getting error Cannot redeclare MailtoController class in components/com_mailto/controller.php. According to the documentation, the override controller file must run and not the old one.

Kindly, guide me what am I doing wrong here

  • Your approach is not good, you should never change core files, otherwise your changes will be lost with every update. Or worse, you won't update and be exposed to security issues discovered in the future. What you need to do is learn how to properly make Joomla extensions... – Marko D May 3 '16 at 21:58
  • Yes I totally agree with you @MarkoD . For this, I could not find anything rather than modifying the file. – Liz. May 4 '16 at 7:23
  • 1
    In this case you probably cannot do it via override, you would need your own plugin to handle this. One user friendly way would be to trigger ajax call when someone clicks on email button to your ajax plugin which will send the actual email – Marko D May 4 '16 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.