mailjet

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package mailjet is the Mailjet adapter (Send API v3.1).

Terms (checked 2026-10-13): the Acceptable Use Policy (https://www.mailjet.com/legal/sending-policy/) allows marketing email only with clear, explicit and provable consent; it forbids third-party lists, requires unsubscribe and privacy-policy links, and sets thresholds of 5% bounces, 0.08% spam complaints and 1.4% unsubscribes. Bulk marketing is therefore allowed on every stream.

Mailjet's exclusion list only applies to its campaigns, not the Send API (https://dev.mailjet.com/docs/email-api/contact-management/manage-exclusion-list). ReputeCast enforces the shared suppression list before sending; the sync keeps Mailjet's own campaigns in line.

Index

Constants

View Source
const Adapter = "mailjet"

Adapter is the registry key.

View Source
const BatchSize = 50

BatchSize is Mailjet's limit of messages per Send API call.

View Source
const DefaultBaseURL = "https://api.mailjet.com"

DefaultBaseURL is Mailjet's API.

View Source
const WebhookUser = "reputecast"

WebhookUser is the basic-auth user put in the event callback URL; the password is the provider's webhook secret.

Variables

This section is empty.

Functions

func Descriptor

func Descriptor() providers.Descriptor

Descriptor describes the adapter for the catalog.

func New

New builds the adapter from a connected provider's configuration.

Types

type Credentials

type Credentials struct {
	APIKey    string `json:"api_key"`
	SecretKey string `json:"secret_key"`
}

Credentials are write-only: the API key and its secret key.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider talks to one Mailjet API key.

func (*Provider) Adapter

func (p *Provider) Adapter() string

Adapter implements providers.Provider.

func (*Provider) AddDomain

func (p *Provider) AddDomain(ctx context.Context, domain string) ([]providers.DNSRecord, error)

AddDomain implements providers.DomainManager: a domain sender (*@domain), which makes Mailjet set up the domain's DNS checks.

func (*Provider) AddSuppressions

func (p *Provider) AddSuppressions(ctx context.Context, emails []string) error

AddSuppressions implements providers.SuppressionSyncer: the addresses are excluded from Mailjet's campaigns (an asynchronous job, 500 per call).

func (*Provider) Backfill

func (p *Provider) Backfill(ctx context.Context, ids []string) ([]providers.Event, error)

Backfill implements providers.EventBackfiller with GET /v3/REST/message: each message's current state.

func (*Provider) Capabilities

func (p *Provider) Capabilities() providers.Capabilities

Capabilities implements providers.Provider.

func (*Provider) DisableTracking

func (p *Provider) DisableTracking(context.Context) error

DisableTracking implements providers.TrackingManager: nothing to change, tracking is off on every message.

func (*Provider) DomainStatus

func (p *Provider) DomainStatus(ctx context.Context, domain string) ([]providers.DNSRecord, error)

DomainStatus implements providers.DomainManager. DNS checks that aren't OK run again, and an inactive domain sender is validated.

func (*Provider) InspectWebhook

func (p *Provider) InspectWebhook(ctx context.Context, hookURL string) (providers.WebhookStatus, error)

InspectWebhook implements providers.WebhookInspector: registered when the sent and bounce callbacks point at the URL and are alive.

func (*Provider) ListSuppressions

func (p *Provider) ListSuppressions(ctx context.Context, since time.Time) ([]providers.Suppression, error)

ListSuppressions implements providers.SuppressionSyncer with the contacts excluded from campaigns: spam complainers, unsubscribed contacts and manual exclusions.

func (*Provider) ParseWebhook

func (p *Provider) ParseWebhook(ctx context.Context, r *http.Request, body []byte) ([]providers.Event, error)

ParseWebhook implements providers.Provider. Mailjet's "Send test" posts an empty payload, which has no events.

func (*Provider) Quota

func (p *Provider) Quota(ctx context.Context) (providers.Quota, error)

Quota implements providers.QuotaReporter: Mailjet has no plan API, so the allowance is the one entered at connect time, against the messages the key sent this month; the key's state (active, locked, quarantined) is the account status.

func (*Provider) RegisterWebhook

func (p *Provider) RegisterWebhook(ctx context.Context, hookURL string) error

RegisterWebhook implements providers.WebhookRegistrar: one callback per event type, grouped (Version 2), on a URL that carries basic auth credentials. Mailjet allows one callback URL per event type and API key; one already pointing elsewhere is left alone and reported.

func (*Provider) RemoveSuppressions

func (p *Provider) RemoveSuppressions(ctx context.Context, emails []string) error

RemoveSuppressions implements providers.SuppressionRemover: the contacts are no longer excluded from campaigns.

func (*Provider) Reputation

func (p *Provider) Reputation(ctx context.Context) (providers.Reputation, error)

Reputation implements providers.ReputationReporter from the key's counters over the last seven days: bounces and spam reports per sent message, as Mailjet's limits count them.

func (*Provider) Send

func (p *Provider) Send(ctx context.Context, msgs []providers.Message) ([]providers.SendResult, error)

Send implements providers.Provider with POST /v3.1/send: up to 50 messages, each with its own result.

func (*Provider) StatusPageURL

func (p *Provider) StatusPageURL() (string, string)

StatusPageURL implements providers.StatusPage.

func (*Provider) Tracking

func (p *Provider) Tracking(context.Context) (providers.Tracking, error)

Tracking implements providers.TrackingManager. Mailjet's account tracking setting has no API, but ReputeCast sends every message with TrackOpens and TrackClicks disabled, so Mailjet never tracks its mail.

func (*Provider) UnregisterWebhook

func (p *Provider) UnregisterWebhook(ctx context.Context, hookURL string) error

UnregisterWebhook implements providers.WebhookUnregistrar with DELETE /v3/REST/eventcallbackurl/{id} (https://dev.mailjet.com/openapi/openapi-mailjet/webhook/delete_v3_eventcallbackurl_id): every callback posting to the URL is deleted, backups included, since the URL stops working with the provider. A 404 is a callback already gone.

func (*Provider) Verify

func (p *Provider) Verify(ctx context.Context) (providers.Quota, error)

Verify implements providers.Verifier.

func (*Provider) VerifyWebhook

func (p *Provider) VerifyWebhook(_ context.Context, r *http.Request, _ []byte) error

VerifyWebhook implements providers.WebhookVerifier: Mailjet doesn't sign event callbacks, so the callback URL ReputeCast registers carries basic auth credentials.

type Settings

type Settings struct {
	// MonthlyLimit is the plan's monthly allowance, entered at connect time.
	MonthlyLimit flex.Int `json:"monthly_limit,omitempty"`
	// BaseURL overrides the API (tests, Mailjet's US infrastructure).
	BaseURL string `json:"base_url,omitempty"`
}

Settings are the non-secret connection settings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL