The TempMailAPI SDK is a PHP library designed to simplify interaction with the TempMail.so API. With this SDK, developers can easily manage temporary email inboxes, retrieve messages, and perform various inbox and message-related actions.
- Domain Management: Retrieve the list of available email domains.
- Inbox Management: Create, list, and delete temporary email inboxes.
- Message Management: Retrieve messages from inboxes, view message details, and delete messages.
- Easy Integration: Simple and clean methods for interacting with the TempMail.so API.
- PHP 7.2 or higher
- cURL extension enabled
- A RapidAPI key and a TempMail.so authentication token.
Include the class in your PHP project:
require_once 'TempMailAPI.php';
- Initialize the
TempMailAPIclass with your RapidAPI key and TempMail.so authentication token:
$apiKey = 'YOUR_RAPIDAPI_KEY';
$authToken = 'YOUR_AUTH_TOKEN';
$tempMail = new TempMailAPI($apiKey, $authToken);- Use the provided methods to interact with the TempMail.so API:
$domains = $tempMail->listDomains();
print_r($domains);$name = 'example';
$domain = 'tempmail.so';
$lifespan = 3600; // Inbox lifespan in seconds
$newInbox = $tempMail->createInbox($name, $domain, $lifespan);
print_r($newInbox);$inboxes = $tempMail->listInboxes();
print_r($inboxes);$inboxId = 'INBOX_ID_HERE';
$messages = $tempMail->listMessages($inboxId);
print_r($messages);If a request fails, the SDK throws an Exception with details about the error:
try {
$domains = $tempMail->listDomains();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}This SDK is licensed under the TempMail.so terms. See the repository for details.
Feel free to open issues or submit pull requests to enhance the SDK.
Make sure to replace placeholders like YOUR_RAPIDAPI_KEY and YOUR_AUTH_TOKEN with actual credentials in your implementation.