Download the PHP package sendpost/sendpost_php_sdk without Composer
On this page you can find all versions of the php package sendpost/sendpost_php_sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sendpost/sendpost_php_sdk
More information about sendpost/sendpost_php_sdk
Files in sendpost/sendpost_php_sdk
Package sendpost_php_sdk
Short Description Email API and SMTP relay to not just send and measure email sending, but also alert and optimise. We provide you with tools, expertise and support needed to reliably deliver emails to your customers inboxes on time, every time.
License unlicense
Homepage https://github.com/sendpost/sendpost_php_sdk
Informations about the package sendpost_php_sdk
sendpost
Introduction
📌 API versioning & the v1 response contract
This reference documents the v1 response contract — the stable, camelCase response shape that SendPost commits to. This is the shape you should build against.
During the current deprecation window, requests authenticated with an account or sub-account API key receive the legacy response shape by default, so existing integrations keep working unchanged. To receive the documented v1 shape today, send:
How to tell which shape you got. Every public response echoes the applied contract in the
X-SendPost-Public-Contractresponse header. While the legacy shape is being served, responses also carry standard deprecation signals:Deprecation: true, aSunsetheader with the exact cut-over date, and aLink: <...>; rel=\"deprecation\"header pointing at the migration guide. Read theSunsetheader for the authoritative end date rather than hardcoding one.After the sunset date, v1 becomes the default and the legacy shape is no longer served. New integrations should send
X-SendPost-Public-Contract: v1now and rely on the shapes in this reference.
SendPost provides email API and SMTP relay which can be used not just to send & measure but also alert & optimised email sending.
You can use SendPost to:
-
Send personalised emails to multiple recipients using email API
-
Track opens and clicks
- Analyse statistics around open, clicks, bounce, unsubscribe and spam
At and advanced level you can use it to:
-
Manage multiple sub-accounts which may map to your promotional or transactional sending, multiple product lines or multiple customers
-
Classify your emails using groups for better analysis
-
Analyse and fix email sending at sub-account level, IP Pool level or group level
-
Have automated alerts to notify disruptions regarding email sending
-
Manage different dedicated IP Pools so to better control your email sending
-
Automatically know when IP or domain is blacklisted or sender score is down
- Leverage pro deliverability tools to get significantly better email deliverability & inboxing
<img src=\"https://run.pstmn.io/button.svg\" alt=\"Run In Postman\" style=\"width: 128px; height: 32px;\">
Overview
REST API
SendPost API is built on REST API principles. Authenticated users can interact with any of the API endpoints to perform:
-
GET- to get a resource
-
POST - to create a resource
-
PUT - to update an existing resource
- DELETE - to delete a resource
The API endpoint for all API calls is:
https://api.sendpost.io/api/v1
Some conventions that have been followed in the API design overall are following:
-
All resources have either
/api/v1/subaccountor/api/v1/accountin their API call resource path based on who is authorised for the resource. All API calls with path/api/v1/subaccountuseX-SubAccount-ApiKeyin their request header. Likewise all API calls with path/api/v1/accountuseX-Account-ApiKeyin their request header. -
All resource endpoints end with singular name and not plural. So we have
domaininstead of domains for domain resource endpoint. Likewise we havesenderinstead of senders for sender resource endpoint. -
Body submitted for POST / PUT API calls as well as JSON response from SendPost API follow camelcase convention
- All timestamps returned in response (created or submittedAt response fields) are UNIX nano epoch timestamp.
<aside class=\"success\">
All resources have either /api/v1/subaccount or /api/v1/account in their API call resource path based on who is authorised for the resource. All API calls with path /api/v1/subaccount use X-SubAccount-ApiKey in their request header. Likewise all API calls with path /api/v1/account use X-Account-ApiKey in their request header.
SendPost uses conventional HTTP response codes to indicate the success or failure of an API request.
-
Codes in the
2xxrange indicate success. -
Codes in the
4xxrange indicate an error owing due to unauthorize access, incorrect request parameters or body etc. - Code in the
5xxrange indicate an eror with SendPost's servers ( internal service issue or maintenance )
<aside class=\"info\">
SendPost all responses return created in UNIX nano epoch timestamp.
Authentication
SendPost uses API keys for authentication. You can register a new SendPost API key at our developer portal.
SendPost expects the API key to be included in all API requests to the server in a header that looks like the following:
X-SubAccount-ApiKey: AHEZEP8192SEGH
This API key is used for all Sub-Account level operations such as:
-
Sending emails
-
Retrieving stats regarding open, click, bounce, unsubscribe and spam
-
Uploading suppressions list
- Verifying sending domains and more
In addition to X-SubAccount-ApiKey you also have another API Key X-Account-APIKey which is used for Account level operations such as :
-
Creating and managing sub-accounts
-
Allocating IPs for your account
-
Getting overall billing and usage information
-
Email List validation
- Creating and managing alerts and more
<aside class=\"notice\">
You must look at individual API reference page to look at whether X-SubAccount-ApiKey is required or X-Account-ApiKey
In case an incorrect API Key header is specified or if it is missed you will get HTTP Response 401 ( Unauthorized ) response from SendPost.
HTTP Response Headers
| Code | Reason | Details |
|---|---|---|
| 200 | Success | Everything went well |
| 401 | Unauthorized | Incorrect or missing API header either X-SubAccount-ApiKey or X-Account-ApiKey |
| 403 | Forbidden | Typically sent when resource with same name or details already exist |
| 406 | Missing resource id | Resource id specified is either missing or doesn't exist |
| 422 | Unprocessable entity | Request body is not in proper format |
| 500 | Internal server error | Some error happened at SendPost while processing API request |
| 503 | Service Unavailable | SendPost is offline for maintenance. Please try again later |
API SDKs
We have native SendPost SDKs in the following programming languages. You can integrate with them or create your own SDK with our API specification. In case you need any assistance with respect to API then do reachout to our team from website chat or email us at [email protected]
API Reference
SendX REST API can be broken down into two major sub-sections:
-
Sub-Account
- Account
Sub-Account API operations enable common email sending API use-cases like sending bulk email, adding new domains or senders for email sending programmatically, retrieving stats, adding suppressions etc. All Sub-Account API operations need to pass X-SubAccount-ApiKey header with every API call.
The Account API operations allow users to manage multiple sub-accounts and manage IPs. A single parent SendPost account can have 100's of sub-accounts. You may want to create sub-accounts for different products your company is running or to segregate types of emails or for managing email sending across multiple customers of yours.
SMTP Reference
Simple Mail Transfer Protocol (SMTP) is a quick and easy way to send email from one server to another. SendPost provides an SMTP service that allows you to deliver your email via our servers instead of your own client or server. This means you can count on SendPost's delivery at scale for your SMTP needs.
Integrating SMTP
-
Get the SMTP
usernameandpasswordfrom your SendPost account. -
Set the server host in your email client or application to
smtp.sendpost.io. This setting is sometimes referred to as the external SMTP server or the SMTP relay. -
Set the
usernameandpassword. - Set the port to
587(or as specified below).
SMTP Ports
-
For an unencrypted or a TLS connection, use port
25,2525or587. -
For a SSL connection, use port
465 - Check your firewall and network to ensure they're not blocking any of our SMTP Endpoints.
SendPost supports STARTTLS for establishing a TLS-encrypted connection. STARTTLS is a means of upgrading an unencrypted connection to an encrypted connection. There are versions of STARTTLS for a variety of protocols; the SMTP version is defined in RFC 3207.
To set up a STARTTLS connection, the SMTP client connects to the SendPost SMTP endpoint smtp.sendpost.io on port 25, 587, or 2525, issues an EHLO command, and waits for the server to announce that it supports the STARTTLS SMTP extension. The client then issues the STARTTLS command, initiating TLS negotiation. When negotiation is complete, the client issues an EHLO command over the new encrypted connection, and the SMTP session proceeds normally.
<aside class=\"success\"> If you are unsure which port to use, a TLS connection on port 587 is typically recommended.
Sending email from your application
For PHP
For Python
For Golang
For Java
Many programming languages support sending email using SMTP. This capability might be built into the programming language itself, or it might be available as an add-on, plug-in, or library. You can take advantage of this capability by sending email through SendPost from within application programs that you write.
We have provided examples in Python3, Golang, Java, PHP, JS.
API Contract Versioning (Public REST)
The public REST API uses a versioned response contract so field changes stay non-breaking:
- Send
X-SendPost-Public-Contract: v1to opt into the current v1 response shape, orlegacyfor the pre-v1 shape. If the header is omitted, the applied contract is policy-driven —legacybefore the published sunset date,v1after it. - Every response echoes
X-SendPost-Public-Contract: <applied>. When thelegacycontract is served, responses also includeDeprecation: true,Sunset: <RFC1123 date>, andLink: <doc-url>; rel=\"deprecation\". - Migrate to
v1before the sunset date. Notable legacy → v1 field changes: Suppressionsmtp_error→smtpError, Statemail_type→emailType.
X-SendPost-Private-Api: trueis an internal header used only by the SendPost dashboard to receive richer internal objects. It is not part of the public SDK contract and should not be set by API integrations.
Installation & Usage
Requirements
PHP 8.1 and later.
Composer
To install the bindings via Composer, add the following to composer.json:
Then run composer install
Manual Installation
Download the files and include autoload.php:
Getting Started
Please follow the installation procedure and then run the following:
API Endpoints
All URIs are relative to https://api.sendpost.io/api/v1
| Class | Method | HTTP request | Description |
|---|---|---|---|
| DomainApi | createSubAccountDomain | POST /subaccount/domain | Create Domain |
| DomainApi | deleteSubAccountDomain | DELETE /subaccount/domain/{domain_id} | Delete Domain |
| DomainApi | getAllDomains | GET /subaccount/domain | List Domains |
| DomainApi | getSubAccountDomain | GET /subaccount/domain/{domain_id} | Get Domain |
| EmailApi | sendEmail | POST /subaccount/email/ | Send Email |
| EmailApi | sendEmailWithTemplate | POST /subaccount/email/template | Send Email With Template |
| IPApi | allocateNewIp | PUT /account/ip/allocate | Allocate IP |
| IPApi | deleteIp | DELETE /account/ip/{ip_id} | Delete IP |
| IPApi | getAllIps | GET /account/ip/ | List IPs |
| IPApi | getSpecificIp | GET /account/ip/{ip_id} | Get IP |
| IPApi | updateIp | PUT /account/ip/{ip_id} | Update IP |
| IPPoolsApi | createIPPool | POST /account/ippool | Create IPPool |
| IPPoolsApi | deleteIPPool | DELETE /account/ippool/{ippool_id} | Delete IPPool |
| IPPoolsApi | getAllIPPools | GET /account/ippool | List IPPools |
| IPPoolsApi | getIPPoolById | GET /account/ippool/{ippool_id} | Get IPPool |
| IPPoolsApi | updateIPPool | PUT /account/ippool/{ippool_id} | Update IPPool |
| MessageApi | getAllMessages | GET /account/message | List Messages |
| MessageApi | getMessageById | GET /account/message/{message_id} | Get Message |
| StatsApi | accountSubaccountStatSubaccountIdAggregateGet | GET /account/subaccount/stat/{subaccount_id}/aggregate | Get Aggregate Stats |
| StatsApi | accountSubaccountStatSubaccountIdGet | GET /account/subaccount/stat/{subaccount_id} | List Stats |
| StatsApi | getAggregateStatsByGroup | GET /account/subaccount/stat/{subaccount_id}/group | Get Group Aggregate Stats |
| StatsAApi | getAccountAggregateStats | GET /account/stat/aggregate | Get Account Aggregate Stats |
| StatsAApi | getAccountAggregateStatsByGroup | GET /account/stat/aggregate/group | Get Account Group Aggregate Stats |
| StatsAApi | getAccountStatsByGroup | GET /account/stat/group | List Account Group Stats |
| StatsAApi | getAllAccountStats | GET /account/stat | List Account Stats |
| SubAccountApi | createSubAccount | POST /account/subaccount/ | Create Sub-Account |
| SubAccountApi | deleteSubAccount | DELETE /account/subaccount/{subaccount_id} | Delete Sub-Account |
| SubAccountApi | getAllSubAccounts | GET /account/subaccount/ | List Sub-Accounts |
| SubAccountApi | getSubAccount | GET /account/subaccount/{subaccount_id} | Get Sub-Account |
| SubAccountApi | updateSubAccount | PUT /account/subaccount/{subaccount_id} | Update Sub-Account |
| SuppressionApi | createSuppression | POST /subaccount/suppression | Create Suppressions |
| SuppressionApi | deleteSuppression | DELETE /subaccount/suppression | Delete Suppressions |
| SuppressionApi | getSuppressionList | GET /subaccount/suppression | List Suppressions |
| WebhookApi | createWebhook | POST /account/webhook | Create Webhook |
| WebhookApi | deleteWebhook | DELETE /account/webhook/{webhook_id} | Delete Webhook |
| WebhookApi | getAllWebhooks | GET /account/webhook | List Webhooks |
| WebhookApi | getWebhook | GET /account/webhook/{webhook_id} | Get Webhook |
| WebhookApi | updateWebhook | PUT /account/webhook/{webhook_id} | Update Webhook |
Models
- AccountCycleUsage
- AccountStats
- AccountWebhookWithStats
- AggregateStat
- AggregateStats
- Attachment
- BlacklistLinks
- BlacklistResource
- BlacklistedOn
- CopyTo
- CreateDomainRequest
- CreateSuppressionRequest
- CreateSuppressionRequestHardBounceInner
- CreateSuppressionRequestManualInner
- CreateSuppressionRequestSpamComplaintInner
- CreateSuppressionRequestUnsubscribeInner
- DailyStatistics
- DateStat
- DeleteResponse
- DeleteSubAccountResponse
- DeleteSuppression200Response
- DeleteSuppressionRequest
- DeleteSuppressionRequestSuppressionsInner
- DeleteWebhookResponse
- Device
- DnsRecord
- Domain
- DomainStat
- EIP
- EmailAddress
- EmailMessage
- EmailMessageObject
- EmailMessageWithTemplate
- EmailResponse
- EmailTypeStat
- ErrorResponse
- ErrorResponseError
- ErrorResponseErrorDetailsInner
- Event
- EventMetadata
- GeoLocation
- GroupStat
- IP
- IPAllocationRequest
- IPDeletionResponse
- IPPool
- IPPoolCreateRequest
- IPPoolDeleteResponse
- IPPoolStat
- IPPoolUpdateRequest
- IPStat
- IPUpdateRequest
- Label
- Member
- Message
- NewSubAccount
- NewWebhook
- Os
- PostmasterDomainStat
- ProviderStat
- RAIPPoolStat
- RDStat
- RIPStat
- RStat
- Recipient
- SDStat
- SMTPAuth
- SeedContactStats
- Stat
- SubAccount
- SubAccountStat
- SubAccountStatForPool
- Suppression
- TPSPStat
- UpdateSubAccount
- UpdateWebhook
- UserAgent
- ValidationStat
- Webhook
- WebhookObject
Authorization
Authentication schemes defined for the API:
accountAuth
- Type: API key
- API key parameter name: X-Account-ApiKey
- Location: HTTP header
subAccountAuth
- Type: API key
- API key parameter name: X-SubAccount-ApiKey
- Location: HTTP header
Tests
To run the tests, use:
Author
About this package
This PHP package is automatically generated by the OpenAPI Generator project:
- API version:
1.3.0- Package version:
2.0.0 - Generator version:
7.13.0
- Package version:
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen
All versions of sendpost_php_sdk with dependencies
ext-curl Version *
ext-json Version *
ext-mbstring Version *
guzzlehttp/guzzle Version ^7.3
guzzlehttp/psr7 Version ^1.7 || ^2.0