Scheduled Email Plugin - Last Run Time

pkjoshi

Active Member
I have set up a Scheduled email plugin to send birthday greeting email, which will test the condition of birthdate as today.
The problem I am facing is I have setup all all my dates stored as local time, but the chrone run time always shows the time in UTC, which has a lag of 5.30 Hours with the Local Standard Time.

Therefore I think it can have undesired result for the gap in time when comparing dates.

Need a clarification and solution on this.

Thanks.
 
Can you show us the code you are using in the Condition for the plugin?

You just need to apply your TZ offset in that code, but I need to see your code to tell you how to modify it.

-- hugh
 
Thanks Hugh, I have now switched to PHP Plugin.
As You have suggested somewhere that email plugin is resource intensive as it iterates over all rows in the list.
The complete code I am using for mail is like:
$app = JFactory::getApplication();
jimport('joomla.mail.helper');

PHP:
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$result = mysql_query("SELECT first_name,email FROM member WHERE
    DAY(birth_date) = DAY(CURDATE()) AND
    MONTH(birth_date) = MONTH(CURDATE())");
if (!$result) {
echo 'Could not run query:' . mysql_error();
exit;
}
 
while($row = mysql_fetch_array($result)) {
$to = $row['email'];
$name = $row['first_name'];
$subject = "Happy Birthday";
$message = "DEAR $name <br>DG TEAM OF DIST.322 C2
WISHES YOU A VERY HAPPY BIRTHDAY.";
 
$MailFrom = "ODLION";
$headers = "From:" . $MailFrom ;
$thisto = $to;
$mail = JFactory::getMailer();
 
$res=$mail->sendmail($MailFrom, $FromName, $thisto, $subject, $message,true);
}
Also please suggest how I can modify the above code so that it can be run using mysqli.
if I am changing my joomla setting to mysqli, the code is simply not working.
I have tried replacing the mysql with mysqli, but that didn't help.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top