plugAPI Integration

Use API credentials to integrate Mailtrap with your project.

1

Go to the Sending Domains tab and choose the domain you want to send emails from. Remember that you'll be able to start sending emails once the domain is verified.

2

Navigate to the Integration tab for your selected domain.

3

Click the Integrate button under Transactional Stream or Bulk Stream.

Transactional Stream is used to send automated, non-promotional application emails triggered by the specific user action.

Bulk Stream is used to send a single marketing campaign to a large group of recipients in bulk.

4

Toggle the switch to API.

5

Build the authenticated HTTP request in your programming language or framework and configure it with Mailtrap Host and API Token.

Transactional Stream API credentials showing Host and API Token
Transactional Stream API credentials
Bulk Stream API credentials showing Host and API Token
Bulk Stream API credentials

Alternatively, choose the programming language or framework from the menu under Code Samples and copy the sample configuration already containing your credentials. In this menu, you'll find official SDKs for PHParrow-up-right, Pythonarrow-up-right, Rubyarrow-up-right, and Node.jsarrow-up-right.

circle-info

Note: For now, only Ruby, PHP (Laravel + Symfony), and Node.js SDKs support Bulk Stream, but others are in development. Request and response examples are also available herearrow-up-right.

Code Samples dropdown showing programming languages including cURL, C++, C#, Go, Java, Node.js, Ruby, Python, and PHP
Transactional Stream code samples
Code Samples dropdown for Bulk Stream showing available programming languages and frameworks
Bulk Stream code samples
6

Complete your script and run it. If you did everything correctly, you should find the sent email in the inbox of the email address you indicated in the script. The email will also appear in Email Logs in Mailtrap.

Remember that each domain has different API tokens that you can always access by clicking on the desired domain and going to the Integration tab.

You can also create additional API tokens by going to SettingsAPI Tokens and clicking Add Token.

magnifying-glassLearn more about API Tokens

Mailtrap Email Sending API supports:

circle-info

If you need any help with API integration, please, contact our support team at [email protected]envelope.

Last updated

Was this helpful?