Sha256: 7e9fc6f1aab387ba24bcd9ffdd095afafbdce12a313834996744eefbddecd871

Contents?: true

Size: 1.82 KB

Versions: 17

Compression:

Stored size: 1.82 KB

Contents

Mailgun - Suppressions
====================

This is the Mailgun Ruby *Suppressions* utilities.

The below assumes you've already installed the Mailgun Ruby SDK in to your
project. If not, go back to the master README for instructions. It currently supports
all calls except credentials.

----

The Suppressions client lets you manage bounces, unsubscribes, and complaints for a
single domain.

You can view additional samples in the [suppressions_spec.rb](/spec/integration/suppressions_spec.rb)
or the Suppressions client API in [suppressions.rb](/lib/mailgun/suppressions.rb).


Usage
-----

To get an instance of the Suppressions client:

```ruby
mg_client = Mailgun::Client.new('api_key')
supp_client = mg_client.suppressions('yourdomain.com')
```

----

To get a list of bounces, unsubscribes, and/or complaints:

```ruby
supp_client.list_bounces
supp_client.list_unsubscribes
supp_client.list_complaints
```

----

To batch-add a set of bounces:

```ruby
@addresses = <load or generate some addresses...>

bounces = []
@addresses.each do |addr|
  bounces.push({
    :address => addr,
    :code => 500,
    :error => 'some bounce because reasons',
  })
end

response, addt_responses = @supp_client.create_bounces bounces
```

`create_bounces`, `create_unsubscribes`, and `create_complaints` will all
return two values - first, a simple `Mailgun::Response` object. Second,
a list containing any `Mailgun::Response` objects created recursively, if over 998
bounces were provided to `create_*`.

----

To delete bounces:

```ruby
@addresses = <load addresses...>

@addresses.each do |addr|
  @supp_client.delete_bounce addr
end
```

Or, alternatively, to remove *all* bounces:

```ruby
@supp_client.delete_all_bounces
```

The `delete_*` methods are similar for `bounces`, `unsubscribe`, and `complaints` -
they all will return a `Mailgun::Response` object.

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
mailgun-ruby-1.2.12 docs/Suppressions.md
mailgun-ruby-1.2.11 docs/Suppressions.md
mailgun-ruby-1.2.10 docs/Suppressions.md
mailgun-ruby-1.2.9 docs/Suppressions.md
mailgun-ruby-1.2.8 docs/Suppressions.md
mailgun-ruby-1.2.7 docs/Suppressions.md
mailgun-ruby-1.2.6 docs/Suppressions.md
mailgun-ruby-1.2.5 docs/Suppressions.md
mailgun-ruby-1.2.4 docs/Suppressions.md
mailgun-ruby-1.2.3 docs/Suppressions.md
mailgun-ruby-1.2.0 docs/Suppressions.md
mailgun-ruby-1.1.11 docs/Suppressions.md
mailgun-ruby-1.1.10 docs/Suppressions.md
mailgun-ruby-1.1.9 docs/Suppressions.md
wj-mailgun-ruby-1.1.7 docs/Suppressions.md
mailgun-ruby-1.1.8 docs/Suppressions.md
mailgun-ruby-1.1.6 docs/Suppressions.md