> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dodopayments.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Customer Email Content

> Get one sent email exactly as it was sent, plus the reason it failed when it did.



## OpenAPI

````yaml get /customers/{customer_id}/emails/{email_log_id}/body
openapi: 3.1.0
info:
  title: public
  description: ''
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 1.113.39
servers:
  - url: https://test.dodopayments.com/
    description: Test Mode Server Host
  - url: https://live.dodopayments.com/
    description: Live Mode Server Host
security: []
tags:
  - name: Products
  - name: Payments
  - name: Subscriptions
  - name: Addons
  - name: Customers
  - name: Refunds
  - name: Disputes
  - name: Events
  - name: License Keys
  - name: Entitlements
  - name: Licenses
  - name: Discounts
  - name: Meters
  - name: Credit Entitlements
  - name: Credit Entitlement Balances
  - name: Outgoing Webhooks
  - name: Checkout
  - name: Webhook Events
  - name: Payment Connector Webhooks
paths:
  /customers/{customer_id}/emails/{email_log_id}/body:
    get:
      tags:
        - Customers
      summary: Get a sent email's content
      description: >-
        Returns the email exactly as it was sent, plus the reason it failed when
        it

        did. Some emails have no body to show: an authentication email carries a

        live login token, a blocked email never reached the provider, and the

        provider clears bodies at 180 days.
      operationId: get_email_body_public
      parameters:
        - name: customer_id
          in: path
          description: The customer's id
          required: true
          schema:
            type: string
        - name: email_log_id
          in: path
          description: The email log entry's id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The email's stored body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailBodyResponse'
        '404':
          description: No such email for this business
        '422':
          description: This email has no body to show
        '500':
          description: Something went wrong :(
        '502':
          description: The email provider is unavailable
      security:
        - API_KEY: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            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);
        - lang: Python
          source: |-
            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)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/dodopayments/dodopayments-go\"\n\t\"github.com/dodopayments/dodopayments-go/option\"\n)\n\nfunc main() {\n\tclient := dodopayments.NewClient(\n\t\toption.WithBearerToken(\"My Bearer Token\"),\n\t)\n\temailBody, err := client.Customers.Emails.GetBody(\n\t\tcontext.TODO(),\n\t\t\"customer_id\",\n\t\t\"email_log_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", emailBody.MerchantAuthored)\n}\n"
        - lang: Java
          source: >-
            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);
                }
            }
        - lang: Kotlin
          source: >-
            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)
            }
        - lang: Ruby
          source: >-
            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)
        - lang: PHP
          source: |-
            <?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();
            }
        - lang: C#
          source: >-
            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);
        - lang: Rust
          source: |-
            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(())
            }
components:
  schemas:
    EmailBodyResponse:
      type: object
      required:
        - merchant_authored
      properties:
        failure_code:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/EmailFailureCode'
              description: >-
                Why the email did not arrive. It is null unless the email
                failed.
        failure_reason:
          type:
            - string
            - 'null'
          description: |-
            A sentence that explains `failure_code`. It is null unless the email
            failed.
        html:
          type:
            - string
            - 'null'
          description: The stored HTML. It is null on a text-only email.
        merchant_authored:
          type: boolean
          description: >-
            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.
        text:
          type:
            - string
            - 'null'
          description: The stored plain text.
    EmailFailureCode:
      type: string
      description: >-
        Why an email did not reach the recipient.


        The code is stable. `send_failed` is the catch-all: it covers every
        failure

        that the other codes do not name.
      enum:
        - mailbox_not_found
        - address_rejected
        - address_suppressed
        - mailbox_full
        - temporary_failure
        - message_too_large
        - marked_as_spam
        - send_failed
        - test_mode_quota_spent
  securitySchemes:
    API_KEY:
      type: http
      scheme: bearer

````