Customers
Get Customer Email Content
Get one sent email exactly as it was sent, plus the reason it failed when it did.
GET
/
customers
/
{customer_id}
/
emails
/
{email_log_id}
/
body
JavaScript
import DodoPayments from 'dodopayments';
const client = new DodoPayments({
bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});
const emailBody = await client.customers.emails.retrieveBody('email_log_id', {
customer_id: 'customer_id',
});
console.log(emailBody.merchant_authored);import os
from dodopayments import DodoPayments
client = DodoPayments(
bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted
)
email_body = client.customers.emails.retrieve_body(
email_log_id="email_log_id",
customer_id="customer_id",
)
print(email_body.merchant_authored)package main
import (
"context"
"fmt"
"github.com/dodopayments/dodopayments-go"
"github.com/dodopayments/dodopayments-go/option"
)
func main() {
client := dodopayments.NewClient(
option.WithBearerToken("My Bearer Token"),
)
emailBody, err := client.Customers.Emails.GetBody(
context.TODO(),
"customer_id",
"email_log_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", emailBody.MerchantAuthored)
}
package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.customers.emails.EmailBody;
import com.dodopayments.api.models.customers.emails.EmailRetrieveBodyParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
EmailRetrieveBodyParams params = EmailRetrieveBodyParams.builder()
.customerId("customer_id")
.emailLogId("email_log_id")
.build();
EmailBody emailBody = client.customers().emails().retrieveBody(params);
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.customers.emails.EmailBody
import com.dodopayments.api.models.customers.emails.EmailRetrieveBodyParams
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: EmailRetrieveBodyParams = EmailRetrieveBodyParams.builder()
.customerId("customer_id")
.emailLogId("email_log_id")
.build()
val emailBody: EmailBody = client.customers().emails().retrieveBody(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
email_body = dodo_payments.customers.emails.retrieve_body("email_log_id", customer_id: "customer_id")
puts(email_body)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Dodopayments\Client;
use Dodopayments\Core\Exceptions\APIException;
$client = new Client(
bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
environment: 'test_mode',
);
try {
$emailBody = $client->customers->emails->retrieveBody(
'email_log_id', customerID: 'customer_id'
);
var_dump($emailBody);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Customers.Emails;
DodoPaymentsClient client = new();
EmailRetrieveBodyParams parameters = new()
{
CustomerID = "customer_id",
EmailLogID = "email_log_id",
};
var emailBody = await client.Customers.Emails.RetrieveBody(parameters);
Console.WriteLine(emailBody);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let customer_id = "customer_id";
let email_log_id = "email_log_id";
let result = client
.customers()
.emails()
.retrieve_body()
.customer_id(customer_id)
.email_log_id(email_log_id)
.await?;
println!("{result:?}");
Ok(())
}curl --request GET \
--url https://test.dodopayments.com/customers/{customer_id}/emails/{email_log_id}/body \
--header 'Authorization: Bearer <token>'{
"merchant_authored": true,
"failure_code": "mailbox_not_found",
"failure_reason": "<string>",
"html": "<string>",
"text": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The customer's id
The email log entry's id
Response
The email's stored body
Whether the merchant wrote this content. It is true for the recovery and dunning emails, which the merchant writes.
The content is email HTML. Render it in a sandbox, whatever this value is.
Why the email did not arrive. It is null unless the email failed.
Available options:
mailbox_not_found, address_rejected, address_suppressed, mailbox_full, temporary_failure, message_too_large, marked_as_spam, send_failed, test_mode_quota_spent A sentence that explains failure_code. It is null unless the email
failed.
The stored HTML. It is null on a text-only email.
The stored plain text.
Last modified on September 18, 2026
Was this page helpful?
⌘I
JavaScript
import DodoPayments from 'dodopayments';
const client = new DodoPayments({
bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});
const emailBody = await client.customers.emails.retrieveBody('email_log_id', {
customer_id: 'customer_id',
});
console.log(emailBody.merchant_authored);import os
from dodopayments import DodoPayments
client = DodoPayments(
bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted
)
email_body = client.customers.emails.retrieve_body(
email_log_id="email_log_id",
customer_id="customer_id",
)
print(email_body.merchant_authored)package main
import (
"context"
"fmt"
"github.com/dodopayments/dodopayments-go"
"github.com/dodopayments/dodopayments-go/option"
)
func main() {
client := dodopayments.NewClient(
option.WithBearerToken("My Bearer Token"),
)
emailBody, err := client.Customers.Emails.GetBody(
context.TODO(),
"customer_id",
"email_log_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", emailBody.MerchantAuthored)
}
package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.customers.emails.EmailBody;
import com.dodopayments.api.models.customers.emails.EmailRetrieveBodyParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
EmailRetrieveBodyParams params = EmailRetrieveBodyParams.builder()
.customerId("customer_id")
.emailLogId("email_log_id")
.build();
EmailBody emailBody = client.customers().emails().retrieveBody(params);
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.customers.emails.EmailBody
import com.dodopayments.api.models.customers.emails.EmailRetrieveBodyParams
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: EmailRetrieveBodyParams = EmailRetrieveBodyParams.builder()
.customerId("customer_id")
.emailLogId("email_log_id")
.build()
val emailBody: EmailBody = client.customers().emails().retrieveBody(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
email_body = dodo_payments.customers.emails.retrieve_body("email_log_id", customer_id: "customer_id")
puts(email_body)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Dodopayments\Client;
use Dodopayments\Core\Exceptions\APIException;
$client = new Client(
bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
environment: 'test_mode',
);
try {
$emailBody = $client->customers->emails->retrieveBody(
'email_log_id', customerID: 'customer_id'
);
var_dump($emailBody);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Customers.Emails;
DodoPaymentsClient client = new();
EmailRetrieveBodyParams parameters = new()
{
CustomerID = "customer_id",
EmailLogID = "email_log_id",
};
var emailBody = await client.Customers.Emails.RetrieveBody(parameters);
Console.WriteLine(emailBody);use dodopayments::Client;
#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let customer_id = "customer_id";
let email_log_id = "email_log_id";
let result = client
.customers()
.emails()
.retrieve_body()
.customer_id(customer_id)
.email_log_id(email_log_id)
.await?;
println!("{result:?}");
Ok(())
}curl --request GET \
--url https://test.dodopayments.com/customers/{customer_id}/emails/{email_log_id}/body \
--header 'Authorization: Bearer <token>'{
"merchant_authored": true,
"failure_code": "mailbox_not_found",
"failure_reason": "<string>",
"html": "<string>",
"text": "<string>"
}