asterisk2billing.org
http://forum.asterisk2billing.org/

Expire Notify Alert mail
http://forum.asterisk2billing.org/viewtopic.php?f=18&t=11862
Page 1 of 1

Author:  clsinc [ Thu Oct 22, 2015 12:24 pm ]
Post subject:  Expire Notify Alert mail

Hi !I am a2billing Beginner user .
I'm looking for a script that mail is sent when a customer of use has expired . :?:

It is only those that you use the mail template , please let us know something hint .
Nice to meet you.

Author:  jroper [ Fri Oct 23, 2015 8:33 am ]
Post subject:  Re: Expire Notify Alert mail

Hi

The card is only set to expired and inactive if a call is attempted, there is no cronjob to check expired cards.

To do this, you would have to write some SQL in a script to check whether a card was expired and send an email.

Joe

Author:  clsinc [ Fri Oct 23, 2015 9:57 am ]
Post subject:  Re: Expire Notify Alert mail

Joe Thank you .

If there is also something sample script An attempt was made to reference .
Please introduce If there be a simple shell script .

Author:  Rabon [ Sat Oct 24, 2015 4:11 pm ]
Post subject:  Re: Expire Notify Alert mail

hi,

you will find autorefill script under cronjobs folder in a2billing. you can EDIT that script to match with your requirements.

Author:  clsinc [ Sun Oct 25, 2015 2:37 am ]
Post subject:  Re: Expire Notify Alert mail

Hi Joe

I'm Try ! Thanks

Author:  clsinc [ Sun Oct 25, 2015 3:03 am ]
Post subject:  Re: Expire Notify Alert mail

Oh! Sorry


Jroper and Rabon Thanks!!

Author:  clsinc [ Sat Oct 31, 2015 10:40 am ]
Post subject:  Re: Expire Notify Alert mail

It is a recent result .
We were set as follows .

/var/spool/cron/root

10 * * * * php /usr/local/src/a2billing/Cronjobs/a2billing_alarm2.php > /dev/null 2>&1

a2billing_alarm2.php

****************************************************************************/
include (dirname(__FILE__) . "/lib/admin.defines.php");
include (dirname(__FILE__) . "/lib/ProcessHandler.php");


// expirationdate >= '".date('Y-m-d H:00:00',strtotime("-1 hour"))." AND expirationdate <= '".date('Y-m-d H:59:59',strtotime("-1 hour"))."
//
// db setting
------

$verbose_level=1;
$QUERY = "SELECT * FROM cc_card WHERE `status` = '5' AND enableexpire = '1' AND expirationdate >= '".date('Y-m-d H:00:00',strtotime("-1 hour"))."' AND expirationdate <= '".date('Y-m-d H:59:59',strtotime("-1 hour"))."'";
//$QUERY = "SELECT * FROM cc_card WHERE id = '2'";
$RESULT = mysql_query($QUERY,$conn) or die(mysql_error());
while($row=mysql_fetch_array($RESULT)){

// SEND REPORT
if ($row) {
$mail_subject = "A2BILLING ALARM : ACCOUNT EXPIRED";

// $mail_content = "ALARM NAME = " . $myalarm[1];
$mail_content="Dear Customer <br>You Account(".$row['username'].")expirationdate(".$row['expirationdate'].")";

try {
// Hostname <myserver-email-address>

$mail = new Mail(null, null, null, $mail_content, $mail_subject);
$mail -> send($row['email']);
// $mail -> send('emailaddress');
} catch (A2bMailException $e) {
if ($verbose_level >= 1)
echo "[Sent mail failed : $e]";
write_log(LOGFILE_CRONT_ALARM, basename(__FILE__) . ' line:' . __LINE__ . "[Sent mail failed : $e]");
}
}
}
if ($verbose_level >= 1)
echo "#### END ALARMS \n";
write_log(LOGFILE_CRONT_ALARM, basename(__FILE__) . ' line:' . __LINE__ . "[#### ALARM END ####]");

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/