You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/emails/src/EmailTask.php
+18-1Lines changed: 18 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -36,8 +36,20 @@ public function needsExecution()
36
36
37
37
publicfunctionexecute()
38
38
{
39
+
$result = [
40
+
'response' => 1,
41
+
'message' => tr('Email inviate correttamente!'),
42
+
];
43
+
39
44
$lista = database()->fetchArray('SELECT * FROM em_emails WHERE (sent_at IS NULL OR failed_at IS NOT NULL) AND attempt<'.prepare(setting('Numero massimo di tentativi')).' ORDER BY created_at LIMIT 0,'.setting('Numero email da inviare in contemporanea per account'));
40
45
46
+
if( empty($lista) ){
47
+
$result = [
48
+
'response' => 1,
49
+
'message' => tr('Nessuna email da inviare'),
50
+
];
51
+
}
52
+
41
53
foreach ($listaas$mail) {
42
54
$mail = Mail::find($mail['id']);
43
55
@@ -46,9 +58,14 @@ public function execute()
46
58
$email->send();
47
59
} catch (Exception$e) {
48
60
echo$e;
61
+
62
+
$result['response'] = 2;
63
+
$result['message'] = tr('Errore durante l\'invio delle email: _ERR_', [
if (setting('Numero di giorni mantenimento coda di invio') > 0) {
48
53
$rs = database()->fetchArray('SELECT * FROM em_emails WHERE sent_at<DATE_SUB(NOW(), INTERVAL '.setting('Numero di giorni mantenimento coda di invio').' DAY) AND id_newsletter IS NOT NULL');
49
54
55
+
if( empty($rs) ){
56
+
$result = [
57
+
'response' => 1,
58
+
'message' => tr('Nessuna email da eliminare'),
59
+
];
60
+
}
61
+
50
62
foreach ($rsas$r) {
51
63
database()->query('DELETE FROM em_emails WHERE id='.prepare($r['id']));
0 commit comments