For the complete documentation index, see llms.txt. This page is also available as Markdown.

SMTP Integration

Integrate Mailtrap SMTP. Get SMTP credentials, choose transactional or bulk sending, use code samples, and start sending.

Learn how to integrate your application via SMTP.

Locating your Mailtrap credentials

spinner
1

Go to the Sending Setup page under API/SMTP 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

Select whether you want to send emails with the Transactional or Bulk Stream.

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

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

3

Toggle the switch to SMTP, and you should see your Mailtrap credentials.

Method #1. Manual SMTP configuration

If you're using a tool like WordPress or Salesforce, you can simply copy/paste credentials such as Host, Port, Username, and Password. Here are some examples:

If you want to send emails from WordPress, you can use one of the many plugins (e.g., WP Mail SMTP or Post SMTP). For example, if you are using WP Mail SMTP, you can just navigate to the settings page and insert the Mailtrap credentials there.

To send emails from Salesforce, simply add your Mailtrap credentials to your Email Relay configuration, just like so:

Method #2. Copy/pasting code samples

If you have a programming project, you can also copy/paste one of the pre-made code samples for various programming languages and frameworks. For instance:

For Nodemailer, all you need to do is copy/paste the pre-made transporter object from Mailtrap into your main configuration file (i.e., index.js).

Similarly, for Laravel, you can just copy the code snippet from Mailtrap into your .env file:

Verifying your configuration

Once you add Mailtrap SMTP to your project, try sending an email from the tool of your choice or the project you're working on. 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 the Mailtrap Email Logs.

Remember that each domain has different API tokens (or SMTP passwords). You can create additional API tokens by going to Settings → API Tokens and clicking Add Token.

Learn more about API Tokens

If you need any help with SMTP integration, please, contact our support team at support@mailtrap.io.

Last updated

Was this helpful?