Skip to content

Commit

Permalink
add remove method
Browse files Browse the repository at this point in the history
  • Loading branch information
noogen committed Jan 13, 2024
1 parent e3cdb07 commit d94f2c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .env.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ GET @home: / = App\Controllers\Index->index

; map routes
; bounce handler routes
GET|POST /api/v1/bounces/complaint = App\Controllers\BouncesController->complaint
GET|POST /api/v1/bounces/hard = App\Controllers\BouncesController->hard
GET|POST /api/v1/bounces/remove = App\Controllers\BouncesController->remove
GET|POST /api/v1/bounces/soft = App\Controllers\BouncesController->soft
GET|POST /api/v1/bounces/complaint = App\Controllers\BouncesController->complaint
GET /api/v1/bounces/stat = App\Controllers\BouncesController->stat
GET /api/v1/bounces/stats = App\Controllers\BouncesController->stats
POST /api/v1/bounces/aws-ses = App\Controllers\BouncesController->awsSes
Expand Down
10 changes: 9 additions & 1 deletion src/Controllers/BouncesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ protected function handleBounce($from, $email, $reason, $increment = 1)

/**
* bulk remove email from bounces
*
*/
protected function unBounce()
public function remove()
{
$values = explode(',', $this->getOrDefault('GET.emails', ''));
$count = count($values);
Expand All @@ -64,6 +65,13 @@ protected function unBounce()
"DELETE FROM bounces WHERE email in ( ?".str_repeat(", ?", $count-1).")",
$values
);


$this->json([
'emails' => $values,
'sendable' => true,
['ttl' => 5] // very low ttl, basically no cache
]);
}

/**
Expand Down

0 comments on commit d94f2c8

Please sign in to comment.