The Multiple Transport plugin extends the Mautic API, allowing you to manage your custom mail transports programmatically. This is useful for automation, integration with other systems, or bulk operations.

Base URL

All API endpoints should be prefixed with your Mautic instance URL:

https://your-mautic-instance.com/api/multipleTransports

Authentication

All requests require authentication using one of these methods:

  • OAuth2: Include the access token in the Authorization header: Authorization: Bearer YOUR_ACCESS_TOKEN
  • Basic Auth: Use your Mautic username and password (if enabled in Configuration > API Settings)

Ensure you have enabled and configured API access in your Mautic settings and have the necessary permissions for multipleTransports.

Get List of Transports

Retrieves a collection of all configured mail transports.

Full URL

GET https://your-mautic-instance.com/api/multipleTransports

Example cURL Request

curl -X GET https://your-mautic-instance.com/api/multipleTransports \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Successful Response (Example)

[
  {
    "id": 1,
    "name": "Amazon SES",
    "mailerDsn": "ses+smtp://KEY:SECRET@default",
    "isPublished": true
  }
]

Get a Specific Transport

Fetches the details of a single mail transport using its unique ID.

Full URL

GET https://your-mautic-instance.com/api/multipleTransports/{id}

Path Parameters

  • {id} (integer, required): The ID of the transport you want to retrieve.

Example cURL Request

curl -X GET https://your-mautic-instance.com/api/multipleTransports/1 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Successful Response (Example)

{
  "id": 1,
  "name": "Amazon SES",
  "mailerDsn": "ses+smtp://KEY:SECRET@default",
  "isPublished": true
}

Create a Transport

Allows you to add a new mail transport to your Mautic instance.

Full URL

POST https://your-mautic-instance.com/api/multipleTransports/new

Request Body Parameters

  • name (string, required): The name for the new transport.
  • description (string, optional): A brief description of the transport’s purpose.
  • mailerDsn (string, required): The DSN string for the mailer.
  • testedEmailFrom (string, optional): Email address used for testing.
  • isPublished (boolean, optional): Whether the transport is enabled.

Example cURL Request

curl -X POST https://your-mautic-instance.com/api/multipleTransports/new \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Sendgrid",
    "description": "Sendgrid SMTP",
    "mailerDsn": "smtp://apikey:SG.xxxxx@default",
    "testedEmailFrom": "me@example.com",
    "isPublished": true
  }'

Example Request Body

{
  "name": "Sendgrid",
  "description": "Sendgrid SMTP",
  "mailerDsn": "smtp://apikey:SG.xxxxx@default",
  "testedEmailFrom": "me@example.com",
  "isPublished": true
}

Successful Response Returns the newly created transport object, similar to the response for GET /api/multipleTransports/{id}.

Edit a Transport

Updates an existing mail transport identified by its ID. You only need to send the fields you want to change.

Full URL

PATCH https://your-mautic-instance.com/api/multipleTransports/{id}/edit

Path Parameters

  • {id} (integer, required): The ID of the transport to edit.

Request Body Parameters

  • name (string, optional): The updated name for the transport.
  • description (string, optional): The updated description.
  • mailerDsn (string, optional): The updated DSN string.
  • testedEmailFrom (string, optional): The updated test email address.
  • isPublished (boolean, optional): Whether the transport is enabled.

Example Request Body (Updating only the name)

{
  "name": "Sendgrid Updated"
}

The documentation states that if the transport doesn’t exist, it might create a new one. Please verify this behavior in your Mautic version.

Successful Response Returns the updated transport object.

Delete a Transport

Permanently removes a mail transport from Mautic based on its ID.

Full URL

DELETE https://your-mautic-instance.com/api/multipleTransports/{id}/delete

Path Parameters

  • {id} (integer, required): The ID of the transport to delete.

Successful Response Typically returns a success status code (e.g., 200 OK or 204 No Content) and potentially a confirmation message in the response body.

Assign Transport to Email

Assigns a transport to a specific email.

Full URL

POST https://your-mautic-instance.com/api/multipleTransport/transportEmail/{emailId}

Path Parameters

  • {emailId} (integer, required): The ID of the email to assign the transport to.

Request Body Parameters

  • transportId (integer, required): The ID of the transport to assign.
  • useOwnerTransport (boolean, optional): Whether to use the owner’s transport.

Example Request Body

{
  "transportId": 2,
  "useOwnerTransport": false
}

Assign Transport to User

Assigns a transport to a specific user.

Full URL

POST https://your-mautic-instance.com/api/multipleTransport/transportUser/{userId}

Path Parameters

  • {userId} (integer, required): The ID of the user to assign the transport to.

Request Body Parameters

  • transportId (integer, required): The ID of the transport to assign.

Example Request Body

{
  "transportId": 2
}

Test a Transport

Sends a test email using the specified transport.

Full URL

POST https://your-mautic-instance.com/api/multipleTransports/send/test/{id}

Path Parameters

  • {id} (integer, required): The ID of the transport to test.

Successful Response (Example)

{
  "success": true,
  "message": "Test email sent"
}

Error Responses

If you use an invalid ID or missing parameters, you may get an error like:

{
  "success": false,
  "error": "Transport not found"
}

Complete API Examples

Example 1: Create a new transport and assign it to an email

# Step 1: Create a new transport
curl -X POST https://your-mautic-instance.com/api/multipleTransports/new \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Marketing Team SMTP",
    "description": "SMTP server for marketing campaigns",
    "mailerDsn": "smtp://user:pass@smtp.example.com:587",
    "isPublished": true
  }'

# Response will include the new transport ID, e.g., {"id": 5, ...}

# Step 2: Assign the transport to an email (ID: 123)
curl -X POST https://your-mautic-instance.com/api/multipleTransport/transportEmail/123 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "transportId": 5,
    "useOwnerTransport": false
  }'

Example 2: Test a transport before using it

# Test transport with ID 5
curl -X POST https://your-mautic-instance.com/api/multipleTransports/send/test/5 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Example 3: Update a transport’s DSN

curl -X PATCH https://your-mautic-instance.com/api/multipleTransports/5/edit \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mailerDsn": "smtp://newuser:newpass@smtp.example.com:587"
  }'

API Path Summary

OperationMethodPath
List all transportsGET/api/multipleTransports
Get specific transportGET/api/multipleTransports/{id}
Create transportPOST/api/multipleTransports/new
Update transportPATCH/api/multipleTransports/{id}/edit
Delete transportDELETE/api/multipleTransports/{id}/delete
Assign to emailPOST/api/multipleTransport/transportEmail/{emailId}
Assign to userPOST/api/multipleTransport/transportUser/{userId}
Test transportPOST/api/multipleTransports/send/test/{id}

Notice that some endpoints use multipleTransport (singular) while others use multipleTransports (plural). This is the actual API implementation.