Official client library for the GoodSender email API. Gem: goodsender
require'goodsender'GoodSender.configuredo |c|
c.scheme='https'c.host='api.goodsender.com'c.base_path=''c.access_token='YOUR_API_KEY'endemails=GoodSender::EmailsApi.newdomains=GoodSender::DomainsApi.newreq=GoodSender::SendEmailRequest.new(emails: [GoodSender::SendEmail.new(from: GoodSender::Address.new(email: 'sender@example.com'),to: [GoodSender::Address.new(email: 'recipient@example.com')],subject: 'Hello',text_content: 'Body')])res=emails.send_email(req)puts"sent=#{res.sent} declined=#{res.declined}"req=GoodSender::TemplateEmailRequest.new(from: GoodSender::Address.new(email: 'sender@example.com'),to: GoodSender::Address.new(email: 'recipient@example.com'),subject: 'Your OTP',template: GoodSender::TemplateEmailRequestTemplate.new(template_id: 'otp_code',variables: {'code'=>'123456'}))res=emails.send_template_email(req)puts"status=#{res.status}"res=domains.list_domains(limit: 50)puts"domains=#{res.domains.length}"res=emails.get_email_consent_status('user@example.com',domain: 'example.com')puts"entries=#{res.length}"# List all consents for a domainres=emails.list_email_consents('example.com',limit: 50)puts"emails=#{(res.emails || []).length}"- API reference: https://goodsender.com/docs
- OpenAPI spec:
openapi/goodsender.yamlin this repo - Conformance tests:
tests/
- Regenerate from spec:
scripts/regen.sh(preservestests/,.github/, and hand-curated files per.regen-ignore) - Run conformance tests against local mock:
tests/run.sh mock - Run conformance against real dev API:
tests/run.sh dev(requirestests/.env.dev)
MIT — see LICENSE.