Email Request Samples

Use these examples to start sending email through the Send Email API.

Start sending emails with the Email API using copy-paste examples for common scenarios like dedicated IP pools, personalization, tags, scheduling, attachments, and AMP email.

Required headers

  • Content-Type: application/json
  • api_key: <Your API Key>

📘

IMPORTANT

This example uses a different endpoint (/v5/mail/send). Use the version your account supports and keep the endpoint consistent across your implementation.

Minimum Required Fields

To send a basic email, include:

  • from.email
  • subject
  • content
  • personalizations[].to

Sandbox vs. activated domain

  • Use your own domain after it is activated.
  • If you don’t have an activated domain, use the Sandbox (Test) environment. With a sandbox, you can typically send only to your registered email address.

Use case 1: Send a simple email

Body

{
  "from": {
    "email": "[email protected]",
    "name": "Flight confirmation"
  },
  "subject": "Your Barcelona flight e-ticket : BCN2118050657714",
  "content": [
    {
      "type": "html",
      "value": "Hello Lionel, Your flight for Barcelona is confirmed."
    }
  ],
  "personalizations": [
    {
      "to": [
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        }
      ]
    }
  ]
}

cURL

curl --request POST \
  --url https://api.pepipost.com/v5/mail/send \
  --header 'Content-Type: application/json' \
  --header 'api_key: <Your API Key>' \
  --data '{
  "from": {
    "email": "[email protected]",
    "name": "Flight confirmation"
  },
  "subject": "Your Barcelona flight e-ticket : BCN2118050657714",
  "content": [
    {
      "type": "html",
      "value": "Hello Lionel, Your flight for Barcelona is confirmed."
    }
  ],
  "personalizations": [
    {
      "to": [
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        }
      ]
    }
  ]
}'

Use case 2: Send an email using a dedicated IP (IP pool)

Use settings.ippool to route email traffic through a specific IP pool.

Body

{
  "from": {
    "email": "[email protected]",
    "name": "Flight Confirmation"
  },
  "subject": "Your Barcelona flight e-ticket : BCN2118050657714",
  "content": [
    {
      "type": "html",
      "value": "Hello Lionel, Your flight for Barcelona is confirmed on 20-01-2021."
    }
  ],
  "personalizations": [
    {
      "to": [
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        }
      ]
    }
  ],
  "settings": {
    "ippool": "pool0"
  }
}

cURL

curl --request POST \
  --url https://api.pepipost.com/v5/mail/send \
  --header 'Content-Type: application/json' \
  --header 'api_key: <Your API Key>' \
  --data '{
  "from": {
    "email": "[email protected]",
    "name": "Flight Confirmation"
  },
  "subject": "Your Barcelona flight e-ticket : BCN2118050657714",
  "content": [
    {
      "type": "html",
      "value": "Hello Lionel, Your flight for Barcelona is confirmed on 20-01-2021."
    }
  ],
  "personalizations": [
    {
      "to": [
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        }
      ]
    }
  ],
  "settings": {
    "ippool": "pool0"
  }
}'

Use case 3: Tag emails for reporting

Use tags to group and filter emails for reporting.

Body

{
  "from": {
    "email": "[email protected]",
    "name": "Flight Confirmation"
  },
  "subject": "Your [%DESTINATION%] flight e-ticket : [%TICKET%]",
  "content": [
    {
      "type": "html",
      "value": "Hello [%NAME%], Your flight for [%DESTINATION%] is confirmed on [%DATE%]."
    }
  ],
  "tags": ["Flight Confirmation", "Barcelona"],
  "personalizations": [
    {
      "attributes": {
        "NAME": "Lionel Messi",
        "DESTINATION": "Barcelona",
        "TICKET": "BCN2118050657714",
        "DATE": "02-01-2021"
      },
      "to": [
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        }
      ]
    }
  ]
}

cURL

curl --request POST \
  --url https://api.pepipost.com/v5/mail/send \
  --header 'Content-Type: application/json' \
  --header 'api_key: <Your API Key>' \
  --data '{
  "from": {
    "email": "[email protected]",
    "name": "Flight Confirmation"
  },
  "subject": "Your [%DESTINATION%] flight e-ticket : [%TICKET%]",
  "content": [
    {
      "type": "html",
      "value": "Hello [%NAME%], Your flight for [%DESTINATION%] is confirmed on [%DATE%]."
    }
  ],
  "tags": ["Flight Confirmation", "Barcelona"],
  "personalizations": [
    {
      "attributes": {
        "NAME": "Lionel Messi",
        "DESTINATION": "Barcelona",
        "TICKET": "BCN2118050657714",
        "DATE": "02-01-2021"
      },
      "to": [
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        }
      ]
    }
  ]
}'

Use case 4: Schedule an email for later

Use schedule to send at a later time (Unix timestamp in seconds).

Body

{
  "from": {
    "email": "[email protected]",
    "name": "Flight Confirmation"
  },
  "subject": "Your [%DESTINATION%] flight e-ticket : [%TICKET%]",
  "content": [
    {
      "type": "html",
      "value": "Hello [%NAME%], Your flight for [%DESTINATION%] is confirmed on [%DATE%]."
    }
  ],
  "personalizations": [
    {
      "attributes": {
        "NAME": "Lionel Messi",
        "DESTINATION": "Barcelona",
        "TICKET": "BCN2118050657714",
        "DATE": "02-01-2021"
      },
      "to": [
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        }
      ]
    }
  ],
  "schedule": "1590466339"
}

cURL

curl --request POST \
  --url https://api.pepipost.com/v5/mail/send \
  --header 'Content-Type: application/json' \
  --header 'api_key: <Your API Key>' \
  --data '{
  "from": {
    "email": "[email protected]",
    "name": "Flight Confirmation"
  },
  "subject": "Your [%DESTINATION%] flight e-ticket : [%TICKET%]",
  "content": [
    {
      "type": "html",
      "value": "Hello [%NAME%], Your flight for [%DESTINATION%] is confirmed on [%DATE%]."
    }
  ],
  "personalizations": [
    {
      "attributes": {
        "NAME": "Lionel Messi",
        "DESTINATION": "Barcelona",
        "TICKET": "BCN2118050657714",
        "DATE": "02-01-2021"
      },
      "to": [
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        }
      ]
    }
  ],
  "schedule":"1590466339"
}'

Use case 5: Send one email copied to multiple recipients (plus attachments)

This sends:

  • A common attachment to all recipients (attachments at root)
  • A recipient-level attachment (personalizations[].attachments)

Body

{
  "from": {
    "email": "[email protected]",
    "name": "Flight Confirmation"
  },
  "subject": "Your [%DESTINATION%] flight e-ticket : [%TICKET%]",
  "content": [
    {
      "type": "html",
      "value": "Hello [%NAME%], Your flight for [%DESTINATION%] is confirmed on [%DATE%]."
    }
  ],
  "attachments": [
    {
      "name": "guidelines.pdf",
      "content": "base64 encoded file content"
    }
  ],
  "personalizations": [
    {
      "attributes": {
        "NAME": "Lionel Messi",
        "DESTINATION": "Barcelona",
        "TICKET": "BCN2118050657714",
        "DATE": "02-01-2021"
      },
      "to": [
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        },
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        }
      ],
      "attachments": [
        {
          "name": "Receipt-BCN2118050657714.pdf",
          "content": "base64 encoded file content"
        }
      ]
    }
  ]
}

cURL

curl --request POST \
  --url https://api.pepipost.com/v5/mail/send \
  --header 'Content-Type: application/json' \
  --header 'api_key: <Your API Key>' \
  --data '{
  "from": {
    "email": "[email protected]",
    "name": "Flight Confirmation"
  },
  "subject": "Your [%DESTINATION%] flight e-ticket : [%TICKET%]",
  "content": [
    {
      "type": "html",
      "value": "Hello [%NAME%], Your flight for [%DESTINATION%] is confirmed on [%DATE%]."
    }
  ],
  "attachments": [
    {
      "name": "guidelines.pdf",
      "content": "base64 encoded file content"
    }
  ],
  "personalizations": [
    {
      "attributes": {
        "NAME": "Lionel Messi",
        "DESTINATION": "Barcelona",
        "TICKET": "BCN2118050657714",
        "DATE": "02-01-2021"
      },
      "to": [
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        },
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        }
      ],
      "attachments": [
        {
          "name": "Receipt-BCN2118050657714.pdf",
          "content": "base64 encoded file content"
        }
      ]
    }
  ]
}'

Use Case 6: Send personalized content to one recipient

Personalize by adding placeholder tags in subject and content.value (example: [%NAME%]) and passing values in personalizations[].attributes.

Body

{
  "from": {
    "email": "[email protected]",
    "name": "Flight Confirmation"
  },
  "subject": "Your [%DESTINATION%] flight e-ticket : [%TICKET%]",
  "content": [
    {
      "type": "html",
      "value": "Hello [%NAME%], Your flight for [%DESTINATION%] is confirmed on [%DATE%]."
    }
  ],
  "personalizations": [
    {
      "attributes": {
        "NAME": "Lionel Messi",
        "DESTINATION": "Barcelona",
        "TICKET": "BCN2118050657714",
        "DATE": "02-01-2021"
      },
      "to": [
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        }
      ]
    }
  ]
}

cURL

curl --request POST \
  --url https://api.pepipost.com/v5/mail/send \
  --header 'Content-Type: application/json' \
  --header 'api_key: <Your API Key>' \
  --data '{
  "from": {
    "email": "[email protected]",
    "name": "Flight Confirmation"
  },
  "subject": "Your [%DESTINATION%] flight e-ticket : [%TICKET%]",
  "content": [
    {
      "type": "html",
      "value": "Hello [%NAME%], Your flight for [%DESTINATION%] is confirmed on [%DATE%]."
    }
  ],
  "personalizations": [
    {
      "attributes": {
        "NAME": "Lionel Messi",
        "DESTINATION": "Barcelona",
        "TICKET": "BCN2118050657714",
        "DATE": "02-01-2021"
      },
      "to": [
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        }
      ]
    }
  ]
}'

Use Case 7: Send personalized content to multiple recipients

Add multiple objects in personalizations, each with its own recipient and attributes.

Body

{
  "from": {
    "email": "[email protected]",
    "name": "Flight Confirmation"
  },
  "subject": "Your [%DESTINATION%] flight e-ticket : [%TICKET%]",
  "content": [
    {
      "type": "html",
      "value": "Hello [%NAME%], Your flight for [%DESTINATION%] is confirmed on [%DATE%]."
    }
  ],
  "personalizations": [
    {
      "attributes": {
        "NAME": "Lionel Messi",
        "DESTINATION": "Barcelona",
        "TICKET": "BCN2118050657714",
        "DATE": "02-01-2021"
      },
      "to": [
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        }
      ]
    },
    {
      "attributes": {
        "NAME": "Cristiano Ronaldo",
        "DESTINATION": "Madrid",
        "TICKET": "MAD2118050657714",
        "DATE": "12-03-2021"
      },
      "to": [
        {
          "email": "[email protected]",
          "name": "Cristiano Ronaldo"
        }
      ]
    }
  ]
}

cURL

curl --request POST \
  --url https://api.pepipost.com/v5/mail/send \
  --header 'Content-Type: application/json' \
  --header 'api_key: <Your API Key>' \
  --data '{
  "from": {
    "email": "[email protected]",
    "name": "Flight Confirmation"
  },
  "subject": "Your [%DESTINATION%] flight e-ticket : [%TICKET%]",
  "content": [
    {
      "type": "html",
      "value": "Hello [%NAME%], Your flight for [%DESTINATION%] is confirmed on [%DATE%]."
    }
  ],
  "personalizations": [
    {
      "attributes": {
        "NAME": "Lionel Messi",
        "DESTINATION": "Barcelona",
        "TICKET": "BCN2118050657714",
        "DATE": "02-01-2021"
      },
      "to": [
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        }
      ]
    },
    {
      "attributes": {
        "NAME": "Cristiano Ronaldo",
        "DESTINATION": "Madrid",
        "TICKET": "MAD2118050657714",
        "DATE": "12-03-2021"
      },
      "to": [
        {
          "email": "[email protected]",
          "name": "Cristiano Ronaldo"
        }
      ]
    }
  ]
}'

Use Case 8: Send a personalized attachment (common + recipient-specific)

Send:

  • One common attachment to all recipients
  • A different receipt per recipient

Body

{
  "from": {
    "email": "[email protected]",
    "name": "Flight Confirmation"
  },
  "subject": "Your [%DESTINATION%] flight e-ticket : [%TICKET%]",
  "content": [
    {
      "type": "html",
      "value": "Hello [%NAME%], Your flight for [%DESTINATION%] is confirmed on [%DATE%]."
    }
  ],
  "attachments": [
    {
      "name": "guidelines.pdf",
      "content": "base64 encoded file content"
    }
  ],
  "personalizations": [
    {
      "attributes": {
        "NAME": "Lionel Messi",
        "DESTINATION": "Barcelona",
        "TICKET": "BCN2118050657714",
        "DATE": "02-01-2021"
      },
      "to": [
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        }
      ],
      "attachments": [
        {
          "name": "Receipt-BCN2118050657714.pdf",
          "content": "base64 encoded file content"
        }
      ]
    },
    {
      "attributes": {
        "NAME": "Cristiano Ronaldo",
        "DESTINATION": "Madrid",
        "TICKET": "MAD2118050657714",
        "DATE": "12-03-2021"
      },
      "to": [
        {
          "email": "[email protected]",
          "name": "Cristiano Ronaldo"
        }
      ],
      "attachments": [
        {
          "name": "Receipt-MAD2118050657714.pdf",
          "content": "base64 encoded file content"
        }
      ]
    }
  ]
}

Use Case 9: Send email to multiple recipients (recommended batching guidance)

If you need to include many recipients:

  • Limit to 100 recipients per API call.
  • Send remaining recipients in additional calls (batch loop).

Use case 10: Send an AMP email (with HTML fallback)

Use AMP content plus HTML fallback in the same request.

Body

{
  "from": {
    "email": "[email protected]",
    "name": "Flight confirmation"
  },
  "subject": "Your Barcelona flight e-ticket : BCN2118050657714",
  "content": [
    {
      "type": "amp",
      "value": "\n<!doctype html>\n<html ⚡4email data-css-strict>\n<head>\n  <meta charset=\"utf-8\">\n  <script async src=\"https://cdn.ampproject.org/v0.js\"></script>\n  <style amp4email-boilerplate>body{visibility:hidden}</style>\n</head>\n<body>\n  Hello, AMP4EMAIL world.This is an AMP email.\n</body>\n</html>\n"
    },
    {
      "type": "html",
      "value": "<p>This is a sample HTML content.</p>"
    }
  ],
  "personalizations": [
    {
      "to": [
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        }
      ]
    }
  ]
}

cURL

curl --request POST \
  --url https://emailapi.netcorecloud.com/v6/mail/send \
  --header 'Content-Type: application/json' \
  --header 'api_key: <Your API Key>' \
  --data '{
  "from": {
    "email": "[email protected]",
    "name": "Flight confirmation"
  },
  "subject": "Your Barcelona flight e-ticket : BCN2118050657714",
  "content": [
    {
      "type": "amp",
      "value": "\n<!doctype html>\n<html ⚡4email data-css-strict>\n<head>\n  <meta charset=\"utf-8\">\n  <script async src=\"https://cdn.ampproject.org/v0.js\"></script>\n  <style amp4email-boilerplate>body{visibility:hidden}</style>\n</head>\n<body>\n  Hello, AMP4EMAIL world.This is an AMP email.\n</body>\n</html>\n"
    },
    {
      "type": "html",
      "value": "<p>This is a sample HTML content.</p>"
    }
  ],
  "personalizations": [
    {
      "to": [
        {
          "email": "[email protected]",
          "name": "Lionel Messi"
        }
      ]
    }
  ]
}'