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
- func Descriptor() providers.Descriptor
- func New(cfg providers.Config) (providers.Provider, error)
- type Credentials
- type Provider
- func (p *Provider) Adapter() string
- func (p *Provider) AddDomain(ctx context.Context, domain string) ([]providers.DNSRecord, error)
- func (p *Provider) AddSuppressions(ctx context.Context, emails []string) error
- func (p *Provider) Backfill(ctx context.Context, ids []string) ([]providers.Event, error)
- func (p *Provider) Capabilities() providers.Capabilities
- func (p *Provider) DisableTracking(context.Context) error
- func (p *Provider) DomainStatus(ctx context.Context, domain string) ([]providers.DNSRecord, error)
- func (p *Provider) InspectWebhook(ctx context.Context, hookURL string) (providers.WebhookStatus, error)
- func (p *Provider) ListSuppressions(ctx context.Context, since time.Time) ([]providers.Suppression, error)
- func (p *Provider) ParseWebhook(ctx context.Context, r *http.Request, body []byte) ([]providers.Event, error)
- func (p *Provider) Quota(ctx context.Context) (providers.Quota, error)
- func (p *Provider) RegisterWebhook(ctx context.Context, hookURL string) error
- func (p *Provider) RemoveSuppressions(ctx context.Context, emails []string) error
- func (p *Provider) Reputation(ctx context.Context) (providers.Reputation, error)
- func (p *Provider) Send(ctx context.Context, msgs []providers.Message) ([]providers.SendResult, error)
- func (p *Provider) StatusPageURL() (string, string)
- func (p *Provider) Tracking(context.Context) (providers.Tracking, error)
- func (p *Provider) UnregisterWebhook(ctx context.Context, hookURL string) error
- func (p *Provider) Verify(ctx context.Context) (providers.Quota, error)
- func (p *Provider) VerifyWebhook(_ context.Context, r *http.Request, _ []byte) error
- type Settings
Constants ¶
const Adapter = "mailjet"
Adapter is the registry key.
const BatchSize = 50
BatchSize is Mailjet's limit of messages per Send API call.
const DefaultBaseURL = "https://api.mailjet.com"
DefaultBaseURL is Mailjet's API.
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.
Types ¶
type Credentials ¶
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) AddDomain ¶
AddDomain implements providers.DomainManager: a domain sender (*@domain), which makes Mailjet set up the domain's DNS checks.
func (*Provider) AddSuppressions ¶
AddSuppressions implements providers.SuppressionSyncer: the addresses are excluded from Mailjet's campaigns (an asynchronous job, 500 per call).
func (*Provider) Backfill ¶
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 ¶
DisableTracking implements providers.TrackingManager: nothing to change, tracking is off on every message.
func (*Provider) DomainStatus ¶
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 ¶
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 ¶
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 ¶
RemoveSuppressions implements providers.SuppressionRemover: the contacts are no longer excluded from campaigns.
func (*Provider) Reputation ¶
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 ¶
StatusPageURL implements providers.StatusPage.
func (*Provider) Tracking ¶
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 ¶
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.
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.