Send Email

Start sending emails through the Postflare API.

POST/emails

Body Parameters

fromstringrequired

Sender email address.

To include a friendly name, use the format "Your Name <sender@domain.com>".

tostring | string[]required

Recipient email address. For multiple addresses, send as an array of strings. Max 50.

subjectstringrequired

Email subject.

bccstring | string[]

Bcc recipient email address. For multiple addresses, send as an array of strings.

ccstring | string[]

Cc recipient email address. For multiple addresses, send as an array of strings.

replyTostring | string[]

Reply-to email address. For multiple addresses, send as an array of strings.

htmlstring

The HTML version of the message.

textstring

The plain text version of the message.

If not provided, the HTML will be used to generate a plain text version.

scheduledAtstring

Schedule email to be sent later. The date should be in natural language (e.g.: in 1 min) or ISO 8601 format (e.g: 2024-08-05T11:52:01.858Z).

Must be within 30 days from now.

headersobject

Custom headers to add to the email.

attachmentsarray

Filename and content of attachments (max 40MB per email, after Base64 encoding of the attachments).

contentstring

Content of an attached file, passed as a Base64 string.

filenamestringrequired

Name of attached file.

pathstring

URL where the attachment file is hosted.

contentTypestring

Content type for the attachment, if not set will be derived from the filename property.

contentIdstring

Content ID for inline images. Use with <img src="cid:..."> in your HTML.

tagsarray

Custom data passed in key/value pairs.

namestringrequired

The name of the email tag.

It can only contain ASCII letters (a–z, A–Z), numbers (0–9), underscores (_), or dashes (-). Max 256 characters.

valuestringrequired

The value of the email tag.

It can only contain ASCII letters (a–z, A–Z), numbers (0–9), underscores (_), or dashes (-). Max 256 characters.

Headers

Idempotency-Keystringheader

Add an idempotency key to prevent duplicated emails.

  • Should be unique per API request
  • Idempotency keys expire after 24 hours
  • Have a maximum length of 256 characters

Response Fields

idstring

The ID of the newly created email.

// Postflare is Resend-compatible — use the Resend SDK
import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.emails.send({
  from: 'Acme <onboarding@resend.dev>',
  to: ['delivered@resend.dev'],
  subject: 'hello world',
  html: '<p>it works!</p>',
  replyTo: 'onboarding@resend.dev',
});
$resend = Resend::client('re_xxxxxxxxx');

$resend->emails->send([
  'from' => 'Acme <onboarding@resend.dev>',
  'to' => ['delivered@resend.dev'],
  'subject' => 'hello world',
  'html' => '<p>it works!</p>',
  'reply_to' => 'onboarding@resend.dev'
]);
import resend

resend.api_key = "re_xxxxxxxxx"

params: resend.Emails.SendParams = {
  "from": "Acme <onboarding@resend.dev>",
  "to": ["delivered@resend.dev"],
  "subject": "hello world",
  "html": "<p>it works!</p>",
  "reply_to": "onboarding@resend.dev"
}

email = resend.Emails.send(params)
print(email)
require "resend"

Resend.api_key = "re_xxxxxxxxx"

params = {
  "from": "Acme <onboarding@resend.dev>",
  "to": ["delivered@resend.dev"],
  "subject": "hello world",
  "html": "<p>it works!</p>",
  "reply_to": "onboarding@resend.dev"
}

sent = Resend::Emails.send(params)
puts sent
package main

import (
  "context"
  "fmt"
  "github.com/resend/resend-go/v3"
)

func main() {
  ctx := context.TODO()
  client := resend.NewClient("re_xxxxxxxxx")

  params := &resend.SendEmailRequest{
    From:    "Acme <onboarding@resend.dev>",
    To:     []string{"delivered@resend.dev"},
    Subject: "hello world",
    Html:    "<p>it works!</p>",
    ReplyTo: "onboarding@resend.dev",
  }

  sent, err := client.Emails.SendWithContext(ctx, params)
  if err != nil {
    panic(err)
  }
  fmt.Println(sent.Id)
}
use resend_rs::types::CreateEmailBaseOptions;
use resend_rs::{Resend, Result};

#[tokio::main]
async fn main() -> Result<()> {
  let resend = Resend::new("re_xxxxxxxxx");

  let from = "Acme <onboarding@resend.dev>";
  let to = ["delivered@resend.dev"];
  let subject = "hello world";
  let html = "<p>it works!</p>";

  let email = CreateEmailBaseOptions::new(from, to, subject)
    .with_html(html);

  let _email = resend.emails.send(email).await?;

  Ok(())
}
import com.resend.*;

public class Main {
  public static void main(String[] args) {
    Resend resend = new Resend("re_xxxxxxxxx");

    CreateEmailOptions params = CreateEmailOptions.builder()
      .from("Acme <onboarding@resend.dev>")
      .to("delivered@resend.dev")
      .subject("hello world")
      .html("<p>it works!</p>")
      .replyTo("onboarding@resend.dev")
      .build();

    CreateEmailResponse data = resend.emails().send(params);
  }
}
using Resend;

IResend resend = ResendClient.Create("re_xxxxxxxxx");

var resp = await resend.EmailSendAsync(new EmailMessage()
{
  From = "Acme <onboarding@resend.dev>",
  To = "delivered@resend.dev",
  Subject = "hello world",
  HtmlBody = "<p>it works!</p>",
  ReplyTo = "onboarding@resend.dev",
});
Console.WriteLine("Email Id={0}", resp.Content);
curl -X POST 'https://api.postflare.app/emails' \
  -H 'Authorization: Bearer re_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "from": "Acme <onboarding@resend.dev>",
    "to": ["delivered@resend.dev"],
    "subject": "hello world",
    "html": "<p>it works!</p>",
    "reply_to": "onboarding@resend.dev"
  }'

Response

Response
{
  "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"
}