mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 03:53:37 +00:00
More checks in the bounce cron job.
This commit is contained in:
@@ -25,7 +25,16 @@ class CronController extends Controller
|
|||||||
|
|
||||||
if (strlen(env('SENDGRID_USERNAME')) > 0 && strlen(env('SENDGRID_PASSWORD')) > 0) {
|
if (strlen(env('SENDGRID_USERNAME')) > 0 && strlen(env('SENDGRID_PASSWORD')) > 0) {
|
||||||
|
|
||||||
$URL = 'https://api.sendgrid.com/api/bounces.get.json';
|
$set = [
|
||||||
|
'blocks' => 'https://api.sendgrid.com/api/blocks.get.json',
|
||||||
|
'bounces' => 'https://api.sendgrid.com/api/bounces.get.json',
|
||||||
|
'invalids' => 'https://api.sendgrid.com/api/invalidemails.get.json',
|
||||||
|
|
||||||
|
];
|
||||||
|
echo '<pre>';
|
||||||
|
foreach ($set as $name => $URL) {
|
||||||
|
|
||||||
|
|
||||||
$parameters = [
|
$parameters = [
|
||||||
'api_user' => env('SENDGRID_USERNAME'),
|
'api_user' => env('SENDGRID_USERNAME'),
|
||||||
'api_key' => env('SENDGRID_PASSWORD'),
|
'api_key' => env('SENDGRID_PASSWORD'),
|
||||||
@@ -39,7 +48,7 @@ class CronController extends Controller
|
|||||||
* Loop the result, if any.
|
* Loop the result, if any.
|
||||||
*/
|
*/
|
||||||
if (is_array($data)) {
|
if (is_array($data)) {
|
||||||
echo 'Found ' . count($data) . ' entries in the SendGrid bounce list.' . "\n";
|
echo 'Found ' . count($data) . ' entries in the SendGrid ' . $name . ' list.' . "\n";
|
||||||
foreach ($data as $entry) {
|
foreach ($data as $entry) {
|
||||||
$address = $entry->email;
|
$address = $entry->email;
|
||||||
$user = User::where('email', $address)->where('blocked', 0)->first();
|
$user = User::where('email', $address)->where('blocked', 0)->first();
|
||||||
@@ -54,6 +63,7 @@ class CronController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
echo 'Done!' . "\n";
|
echo 'Done!' . "\n";
|
||||||
} else {
|
} else {
|
||||||
echo 'Please fill in SendGrid details.';
|
echo 'Please fill in SendGrid details.';
|
||||||
|
Reference in New Issue
Block a user