The Automation API is now available. No CLI. No human-in-the-loop. Just your code. Learn More

Mailgun

The Mailgun provider for Pulumi can be used to provision any of the cloud resources available in Mailgun. The Mailgun provider must be configured with credentials to deploy and update resources in Mailgun.

See the full API documentation for complete details of the available Mailgun provider APIs.

Setup

The Mailgun provider supports several options for providing access to Mailgun credentials. See the Mailgun setup page for details.

Example

const mailgun = require("@pulumi/mailgun")

const route = new mailgun.Route("test-route", {
    priority: 0,
    description: "Inbound route",
    expression: "match_recipient('.*@example.com')",
    actions: [
        "forward('http://example.com/api/v1/foos/')",
        "stop()"
    ]
});
import * as mailgun from "@pulumi/mailgun";

const route = new mailgun.Route("test-route", {
    priority: 0,
    description: "Inbound route",
    expression: "match_recipient('.*@example.com')",
    actions: [
        "forward('http://example.com/api/v1/foos/')",
        "stop()"
    ]
});
import pulumi_mailgun as mailgun

route = mailgun.Route("test-route",
  priority=0,
  description="Inbound route",
  expression="match_recipient('.*@example.com')",
  actions=[
    "forward('http://example.com/api/v1/foos/')",
    "stop()"
])
import (
  "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
  mailgun "github.com/pulumi/pulumi-mailgun/sdk/v2/go/mailgun"
)

route, _ := mailgun.NewRoute(ctx, "test-route", &mailgun.RouteArgs{
  Priority:    pulumi.Int(0),
  Description: pulumi.String("Inbound route"),
  Expression:  pulumi.String("match_recipient('.*@example.com')"),
  Actions: [
    pulumi.String("forward('http://example.com/api/v1/foos/')"),
    pulumi.String("stop()"),
]})
using System.Collections.Generic;
using System.Threading.Tasks;
using Pulumi;
using Pulumi.Mailgun;

class Program
{
    static Task Main() =>
        Deployment.Run(() => {
            var route = new Route("test-route", new RouteArgs
            {
                Priority = 0,
                Description = "Inbound route",
                Expression = "match_recipient('.*@example.com')",
                Actions = [
                    "forward('http://example.com/api/v1/foos/')",
                    "stop()"
                ],
            });
        });
}

Libraries

The following packages are available in packager managers:

The Mailgun provider is open source and available in the pulumi/pulumi-mailgun repo.