---
title: Python
description: "The Unsend Python package lets you interact with the Unsend API to send and manage emails as well as domains. This is a quick guide on using the package to send emails and retrieve email information."
icon: python
---
hello,
Unsend is the best open source sending platform
check out unsend.dev
", } # Send the email response = client.send_email(payload) print("Send Email Response:", response) ``` ### Retrieve Emails using the id The email will be retrieved using the ID you get after sending the mail. ```python email_id = 'email-id-from-unsend' email_response = client.get_email(email_id) print("Get Email Response:", email_response) ``` The sample response of `get_email` is shown below: ```bash { "data": { "id": "your-email-id", "teamId": 1, "to": [ "yourmail@example.com" ], "from": "hello@mail.example.com", "subject": "Unsend test email", "html": "hello,
Unsend is the best open source sending platform
check out unsend.dev
", "text": "hello,\n\nUnsend is the best open source sending platform", "createdAt": "2024-07-29T05:04:21.498Z", "updatedAt": "2024-07-29T05:04:27.130Z", "emailEvents": [ { "emailId": "your-email-id", "status": "FAILED", "createdAt": "2024-07-29T05:04:27.124Z", "data": { "error": "MessageRejected: Email address is not verified. The following identities failed the check in region US-EAST-1: example@gmail.com" } } ] }, "error": null } ``` ### Retrieve domain information Retrieves domain information Domains that are associated with this account will be displayed with their detailed information. ```python domain_response = client.get_domain() print("Get Domain Response:", domain_response) ``` Sample response of the `get_domain` method ```bash { "data": [ { "id": 1, "name": "mail.domain.com", "teamId": 1, "status": "SUCCESS", "region": "us-east-1", "clickTracking": false, "openTracking": false, "publicKey": "your-public-key", "dkimStatus": "SUCCESS", "spfDetails": "SUCCESS", "dmarcAdded": false, "errorMessage": null, "subdomain": "mail", "isVerifying": false, "createdAt": "2024-07-26T05:52:17.199Z", "updatedAt": "2024-07-26T05:57:27.790Z" } ], "error": null } ```