Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
arduinomaster22 committed Jan 23, 2025
1 parent 1e3ac17 commit 1b7f778
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
13 changes: 5 additions & 8 deletions src/Drivers/MailgunDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

namespace Vormkracht10\Mails\Drivers;

use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\URL;
use Vormkracht10\Mails\Contracts\MailDriverContract;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Http;
use Vormkracht10\Mails\Enums\EventType;
use Vormkracht10\Mails\Contracts\MailDriverContract;

class MailgunDriver extends MailDriver implements MailDriverContract
{
Expand Down Expand Up @@ -128,16 +129,12 @@ public function dataMapping(): array
];
}

public function unsuppressEmailAddress(string $address): void
public function unsuppressEmailAddress(string $address): Response
{
$client = Http::asJson()
->withBasicAuth('api', config('services.mailgun.secret'))
->baseUrl(config('services.mailgun.endpoint').'/v3/');

$response = $client->delete(config('services.mailgun.domain').'/unsubscribes/'.$address);

if (! $response->successful()) {
//
}
return $client->delete(config('services.mailgun.domain').'/unsubscribes/'.$address);
}
}
10 changes: 4 additions & 6 deletions src/Drivers/PostmarkDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Vormkracht10\Mails\Drivers;

use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\URL;
use Vormkracht10\Mails\Contracts\MailDriverContract;
Expand Down Expand Up @@ -140,24 +141,21 @@ public function dataMapping(): array
];
}

public function unsuppressEmailAddress(string $address, $stream_id): void
public function unsuppressEmailAddress(string $address, $stream_id): Response
{
$client = Http::asJson()
->withHeaders([
'X-Postmark-Server-Token' => config('services.postmark.token'),
])
->baseUrl('https://api.postmarkapp.com/');

$response = $client->post('message-streams/'.$stream_id.'/suppressions/delete', [
return $client->post('message-streams/'.$stream_id.'/suppressions/delete', [
'Suppressions' => [
[
'emailAddress' => $address,
],
],
]);

if (! $response->successful()) {
//
}

}
}

0 comments on commit 1b7f778

Please sign in to comment.