If you are like me you have probably written a number of other PHP scripts that get executed from time to time. If these scripts generate emails you should probably make sure they are processed through JMailQ. This will only happen if you instantiate the JMailQ class itself instead of using phpmailer. Using the JFactory::getMailer() call will give you the correct object.


To use the JMailQ class directly you will need to add the following include statement into your PHP scripts after the Joomla framework includes:


require_once(JPATH_PLUGINS . '/system/jmailq/jmailq.php');


And then instantiate the class with $mail = new JMailqMailer. You can then use all the usual JMail or phpmailer calls you would normally use.


A better way to do this would be to ensure Joomla itself is properly bootstrapped. This is easy with the joomla CLI interface.