How to Enable Weekly / Monthly or Daily Email Reports and Alerts

1. Configure Email Settings

There are three things you should do to enable email alerts / reports in Watch My Domains Server Edition. The first step is specifying your email settings like "From Address", "From Name", etc.

Go to the "App Settings" and select the "Email Options" tab. Enter the various email settings like From Address, From Name, Email Method etc. In most cases you can leave the "Send Method" at "default". For the default method you don't have to provide a smtp password or login name.

In some cases you may need to use SMTP, and avoid the default method, to prevent the emails from getting labelled as SPAM.

Email Settings

2. Select a suitable Script from the Samples

The lib/php/custom folder has a number of sample scripts. Choose one of them, for example, expiry-report-sample.php, copy it to expiry-report.php and open it in a text editor. Make changes to include your "to" email address. If you want, you can also change the number of days to monitor for expiry dates, the columns to include in email and so on. Also set the "$sendemail" to true.

3. Test the Email Script and Add it as a Cron Job

Open lib/php/expiry-report.php in a browser. This should show you an HTML report. If you have set the "$sendemail" to true, an email also should come to the specified address.

Testing Domain Expiry Reports

Add the script to cron table if every thing is working fine. The following entry will send emails every week.

0 0 * * 0 php /home/softnik/wmdsed24/lib/php/custom/expiry-report.php >/dev/null 2>&1

or

0 0 * * 0 wget -q -O /dev/null "http://www.example.com/wmdsed30/lib/php/custom/expiry-report.php?key=xxxx" >/dev/null 2>&1

Please remember to edit the path to the script as required. Replace xxx with your CLI authorization key (if you are using wget) . This key is available in the "Authentication" of "Basic App Setup" screen.

CLI Authorization Key

The CLI Authorization Key is used to run various reports and other scripts as a cron job. The report generation scripts will run only if you are logged in (assuming you have enabled the built-in password protection). This will be a problem when you try to run scripts as a cron job. The CLI authorization key allows you to specify key=xxx as a GET variable (when running as a web script) so that the script will execute without logging in.

CLI Authorization Key

The CLI key is not required if you are running the script as a PHP command line option. It is required only if you are using wget or lynx to run the cron.