Sunday, April 16, 2017

A Joomla CLI script to send database query output as a CSV attachment via email





image from: https://pixabay.com/en/linux-window-terminal-command-154766/

This Joomla CLI script lets you send a DB query output as a CSV attachment via Email.

You need to have a working Joomla website instance with emails setup done.

PHP Joomla CLI Script:
To use this:
1. Open terminal, Browse to Joomla root

cd /var/www/my-joomla-site

2. Execute PHP file 


php cli/joomla-cli-script-email-csv-attachment.php

3. You will see this as o/p on successful email sending 


Email sent

You can also setup cronjob to automate email sending.