@@ -94,6 +94,7 @@ public static function schedule_email($email_id , $tokens = array() , $action =
9494
9595 /* Prepare Schedule time */
9696 $ timestamp = Inbound_Mailer_Scheduling::get_timestamp ();
97+ $ store_time = new DateTime ($ timestamp );
9798
9899 /* prepare rule and action id if none are set */
99100 if (!isset ($ action ['rule_id ' ])) {
@@ -117,7 +118,7 @@ public static function schedule_email($email_id , $tokens = array() , $action =
117118 $ query_prefix .= "VALUES " ;
118119
119120 foreach ($ leads as $ ID ) {
120- $ query_values_array [] = "( {$ email_id } , {$ vid } , {$ ID } , ' " . Inbound_Mailer_Scheduling::$ settings ['email_type ' ] . "' , ' " .$ tokens_encoded ."' ,'waiting' , ' {$ timestamp }' , ' {$ action ['rule_id ' ]}' , ' {$ action ['job_id ' ]}', ' " .json_encode (Inbound_Mailer_Scheduling::$ recipients )."' , ' " .$ post_id ."') " ;
121+ $ query_values_array [] = "( {$ email_id } , {$ vid } , {$ ID } , ' " . Inbound_Mailer_Scheduling::$ settings ['email_type ' ] . "' , ' " .$ tokens_encoded ."' ,'waiting' , ' {$ store_time -> format ( ' Y-m-d G:i:s ' ) }' , ' {$ action ['rule_id ' ]}' , ' {$ action ['job_id ' ]}', ' " .json_encode (Inbound_Mailer_Scheduling::$ recipients )."' , ' " .$ post_id ."') " ;
121122 }
122123
123124 $ value_batches = array_chunk ($ query_values_array , 500 );
@@ -135,6 +136,7 @@ public static function schedule_email($email_id , $tokens = array() , $action =
135136 if ($ email_service == "wp_mail " ) {
136137 $ current_date_obj = new DateTime (date_i18n ('Y-m-d G:i:s ' ));
137138 $ scheduled_date_obj = new DateTime ($ timestamp );
139+
138140 if ($ scheduled_date_obj > $ current_date_obj ) {
139141 wp_update_post (array (
140142 'ID ' => $ email_id ,
@@ -170,7 +172,7 @@ public static function get_timestamp() {
170172 $ settings = Inbound_Mailer_Scheduling::$ settings ;
171173
172174 if ($ settings ['email_type ' ] == 'automated ' ) {
173- return gmdate ( " Y-m-d \\ TG :i:s\\ Z " );
175+ return date_i18n ( ' Y-m-d G :i:s ' );
174176 }
175177
176178 if (isset ($ settings ['timezone ' ])) {
@@ -181,7 +183,7 @@ public static function get_timestamp() {
181183
182184 /* add date if does not exist */
183185 if (!$ settings ['send_datetime ' ]) {
184- $ settings ['send_datetime ' ] = date_i18n ('Y-m-d G:i ' );
186+ $ settings ['send_datetime ' ] = date_i18n ('Y-m-d G:i:s ' );
185187 }
186188
187189 /* add time if does not exist */
@@ -215,7 +217,7 @@ public static function get_timestamp() {
215217 $ timestamp = $ schedule_date ->format ('Y-m-d \\TG:i:s \\Z ' );
216218 break ;
217219 case "wp_mail " :
218- $ timestamp = $ schedule_date ->format ('Y-m-d \\ TG :i:s\\ Z ' );
220+ $ timestamp = $ schedule_date ->format ('Y-m-d G :i:s ' );
219221 break ;
220222 }
221223
0 commit comments