Saltar para a documentação
Go

client.Suppressions

Cada método deste espaço de nomes: a sua assinatura, os seus parâmetros, o que devolve e um exemplo.

Métodos

The addresses this workspace will not send to: hard bounces, complaints and the ones you block by hand.

Suppressions.List

List one page of the suppression list

Âmbitossettings:readPercorre os resultados por páginas
Assinatura
List(ctx context.Context, opts ...openemail.RequestOption) (*openemail.Page, error)

Returns one page of the addresses this workspace will not send to, newest first: every address that bounced hard, complained, or was added by hand. ListAll collects every page and Iterate walks them lazily.

A send to a suppressed address is refused for that recipient before anything leaves, and a message whose recipients are all suppressed fails outright. The list belongs to the whole workspace, so a key limited to some addresses reads all of it, and a row names the recipient, never which of your addresses sent to it.

removable says whether Remove will take the address off. A hard bounce is permanent here, because the address could not take mail. A complaint or a manual entry can be removed.

Parâmetros

openemail.WithQstring

Searches the address, the reason and the detail. Words match loosely, and a close spelling is tried when nothing matches exactly.

openemail.WithReasonstring

Keeps one kind: bounce, complaint or manual.

openemail.WithLimitint

Page size, from 1 to 100. The server defaults to 25.

openemail.WithCursorstring

The NextCursor of the previous page. Leave it out for the first page.

openemail.WithAPIKeystring

Overrides the client API key for this call only.

Devolve

A *openemail.Page with Items, HasMore and NextCursor. Each item has id, email, reason, detail, removable and createdAt.

Exemplo

page, err := client.Suppressions.List(ctx, openemail.WithReason("complaint"))if err != nil {	return err} for _, suppression := range page.Items {	fmt.Println(suppression.String("email"), suppression.String("createdAt"))} fmt.Println(page.HasMore, page.NextCursor)

Notas

  • Needs settings:read, the scope the Blocked addresses screen in Settings is gated on.

  • The cursor is opaque and holds where the last row sat, so an address removed between pages never breaks the walk. A cursor this list did not hand out is a 400 invalid_cursor.

Também disponível em

API
GET /suppressions
TypeScript
suppressions.list()
Python
suppressions.list()
Ruby
suppressions.list
PHP
suppressions->list
Java
suppressions().list
C#
Suppressions.ListAsync
CLI
openemail suppressions list

Suppressions.ListAll

Collect the whole suppression list into one slice

Âmbitossettings:readPercorre os resultados por páginas
Assinatura
ListAll(ctx context.Context, opts ...openemail.RequestOption) ([]openemail.Object, error)

Walks every page of List and returns with every suppressed address, newest first. One request per page, with the same filters on each.

Parâmetros

openemail.WithQstring

Searches the address, the reason and the detail. Words match loosely, and a close spelling is tried when nothing matches exactly.

openemail.WithReasonstring

Keeps one kind: bounce, complaint or manual.

openemail.WithLimitint

Page size for each request, from 1 to 100. The server defaults to 25.

openemail.WithCursorstring

Starts the walk after this cursor instead of the first page.

openemail.WithAPIKeystring

Overrides the client API key for every page of this walk.

Devolve

A []openemail.Object holding every suppressed address.

Exemplo

all, err := client.Suppressions.ListAll(ctx, openemail.WithLimit(100))if err != nil {	return err} for _, suppression := range all {	fmt.Println(suppression.String("email"))}

Notas

  • If any page fails the call fails and the rows already fetched are discarded.

Também disponível em

API
GET /suppressions
TypeScript
suppressions.listAll()
Python
suppressions.list_all()
Ruby
suppressions.list_all
PHP
suppressions->listAll
Java
suppressions().listAll
C#
Suppressions.ListAllAsync

Suppressions.Iterate

Stream the suppression list one address at a time

Âmbitossettings:readPercorre os resultados por páginas
Assinatura
Iterate(ctx context.Context, opts ...openemail.RequestOption) *openemail.Iterator

Returns an iterator that yields one suppressed address at a time, newest first, and requests the next page only once the current one is drained. Nothing is fetched until you consume it, and breaking out of the loop stops the requests.

Parâmetros

openemail.WithQstring

Searches the address, the reason and the detail. Words match loosely, and a close spelling is tried when nothing matches exactly.

openemail.WithReasonstring

Keeps one kind: bounce, complaint or manual.

openemail.WithLimitint

Page size for each request, from 1 to 100. The server defaults to 25.

openemail.WithCursorstring

Starts the walk after this cursor instead of the first page.

openemail.WithAPIKeystring

Overrides the client API key for every page of this walk.

Devolve

An *openemail.Iterator yielding one suppressed address per step.

Exemplo

for suppression, err := range client.Suppressions.Iterate(ctx, openemail.WithQ("example.com")).All() {	if err != nil {		return err	} 	fmt.Println(suppression.String("email"), suppression.String("reason"))}

Notas

  • The iterator is lazy, so an abandoned loop costs only the pages you consumed.

Também disponível em

API
GET /suppressions
TypeScript
suppressions.iterate()
Python
suppressions.iterate()
Ruby
suppressions.iterate
PHP
suppressions->iterate
Java
suppressions().iterate
C#
Suppressions.IterateAsync

Suppressions.Get

Read one suppressed address by id

Âmbitossettings:read
Assinatura
Get(ctx context.Context, id string, opts ...openemail.RequestOption) (openemail.Object, error)

Returns one row of the suppression list: the address, why it is there, the detail the bounce or complaint carried, whether it can be removed and when it was added.

Parâmetros

idstringObrigatório

The id from List.

openemail.WithAPIKeystring

Overrides the client API key for this call only.

Devolve

An openemail.Object with id, email, reason, detail, removable and createdAt.

Exemplo

row, err := client.Suppressions.Get(ctx, "7b1e2c3d-4f5a-4b6c-8d7e-9f0a1b2c3d4e")if err != nil {	return err} fmt.Println(row.String("email"), row.Bool("removable"))

Notas

Também disponível em

API
GET /suppressions/{id}
TypeScript
suppressions.get()
Python
suppressions.get()
Ruby
suppressions.get
PHP
suppressions->get
Java
suppressions().get
C#
Suppressions.GetAsync
CLI
openemail suppressions get

Suppressions.Add

Stop sending to an address

Âmbitossettings:write
Assinatura
Add(ctx context.Context, body openemail.Body, opts ...openemail.RequestOption) (openemail.Object, error)

Puts an address on the suppression list by hand, with reason: 'manual', so no address in the workspace sends to it again until it is removed. It is the Block an address control on the Blocked addresses screen.

Adding an address that is already there changes nothing: the server answers 200 with the row it already holds, whatever its reason, where a new entry answers 201. Either way you get the row back. A new entry fires suppression.added to the webhooks that asked for it.

Parâmetros

emailstringObrigatório

The address to stop sending to. It is trimmed and lower cased.

openemail.WithAPIKeystring

Overrides the client API key for this call only.

Devolve

An openemail.Object for the address, new or already there.

Exemplo

row, err := client.Suppressions.Add(ctx, openemail.Body{"email": "[email protected]"})if err != nil {	return err} fmt.Println(row.String("reason"), row.String("createdAt"))

Notas

  • Safe to repeat: a second add finds the first entry, so the SDK retries it after a network failure.

  • A key limited to particular addresses or domains is refused with 422 capability_unsupported, because the list stops mail from every address in the workspace. So is an app connected by anybody but the owner.

Também disponível em

API
POST /suppressions
TypeScript
suppressions.add()
Python
suppressions.add()
Ruby
suppressions.add
PHP
suppressions->add
Java
suppressions().add
C#
Suppressions.AddAsync
CLI
openemail suppressions add

Suppressions.Remove

Allow mail to an address again

Âmbitossettings:write
Assinatura
Remove(ctx context.Context, id string, opts ...openemail.RequestOption) (openemail.Object, error)

Takes an address off the suppression list, so mail may go to it again. It is Allow again on the Blocked addresses screen, and it fires suppression.removed.

Only a complaint or a manual entry can be removed. A hard bounce answers 409 suppression_not_removable and stays, because the address could not take mail: check it is spelled right and send to the corrected one instead.

Parâmetros

idstringObrigatório

The id from List.

openemail.WithAPIKeystring

Overrides the client API key for this call only.

Devolve

An openemail.Object with object set to suppression, id, email and deleted set to true.

Exemplo

suppression, err := client.Suppressions.Remove(ctx, "7b1e2c3d-4f5a-4b6c-8d7e-9f0a1b2c3d4e")if err != nil {	return err} fmt.Println(suppression.String("id"), suppression.String("email"))

Notas

  • The SDK does not retry a delete. A 404 on your own second attempt after a lost response means the first one worked.

  • A key limited to particular addresses or domains is refused with 422 capability_unsupported.

Também disponível em

API
DELETE /suppressions/{id}
TypeScript
suppressions.remove()
Python
suppressions.remove()
Ruby
suppressions.remove
PHP
suppressions->remove
Java
suppressions().remove
C#
Suppressions.RemoveAsync
CLI
openemail suppressions remove