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.

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.

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.

Path Parameters

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

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.

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 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.

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.

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.

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.

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.

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"
}