https://github.com/ahmedghanem00/tempmail-api-client
An API client for Temp-Mail service ( https://rapidapi.com/Privatix/api/temp-mail )
https://github.com/ahmedghanem00/tempmail-api-client
api-client api-client-php disposable-email php temporary-email
Last synced: 6 months ago
JSON representation
An API client for Temp-Mail service ( https://rapidapi.com/Privatix/api/temp-mail )
- Host: GitHub
- URL: https://github.com/ahmedghanem00/tempmail-api-client
- Owner: ahmedghanem00
- License: mit
- Created: 2024-03-22T01:35:50.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-06-15T14:06:12.000Z (over 1 year ago)
- Last Synced: 2025-02-07T06:30:07.236Z (8 months ago)
- Topics: api-client, api-client-php, disposable-email, php, temporary-email
- Language: PHP
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TempMail API Client
An API client for Temp-Mail service ( https://rapidapi.com/Privatix/api/temp-mail )
## Installation
````
composer require ahmedghanem00/tempmail-api-client
````## Usage
#### Client Initialization :
````php
use ahmedghanem00\TempMailClient\Client;$client = new Client('YOUR_API_TOKEN');
````#### Get Available Domains
Retrieve a fresh data from the server:
````php
$client->retrieveMailDomains();
````Get the cached domains in the client (Domains are cached when client initialized for the first time)
````php
$client->getCachedMailDomains();
````#### Generate a Random Email
````php
$receiver = $client->generateFullyRandomReceiver();
## OR
$receiver = $client->generateRandomReceiverFromEmailName("my-random-email");echo $receiver->getFullEmailAddress(); // string "bdmhnjbtyj@nuclene.com" OR "my-random-email@nuclene.com"
echo $receiver->getEmailName(); // string "bdmhnjbtyj" OR "my-random-email"
echo $receiver->getEmailDomain(); // string "nuclene.com"
````#### Get email messages
````php
$messages = $receiver->inbox()->retrieveAll();/* @var $message \ahmedghanem00\TempMailClient\Model\Message */
foreach ($messages as $message) {
echo $message->getSubject(); // string
echo $message->getText(); // string
echo $message->getSenderName(); // string "Joe"
echo $message->getSenderEmail(); // string
echo $message->getReceiveTimestamp(); // float
echo $message->getHtml(); // string
echo $message->getPreview(); // string
# Message id
echo $message->getServiceInternalId(); // string
/* @var $attachment \ahmedghanem00\TempMailClient\Model\Attachment */
foreach ($message->getAttachments() as $attachment) {
echo $attachment->getName(); // string
echo $attachment->getContentType(); // string
echo $attachment->getSize(); // int
echo $attachment->getContent(); // string
}
}
````#### Retrieve a Specific Message
````php
$message = $receiver->inbox()->retrieveMessage(MessageId: "dk4kdkmv");
````#### Delete a Specific Message
````php
$receiver->inbox()->deleteMessage(MessageId: "dk4kdkmv");
````## LICENSE
Package is licensed under the [MIT License](http://opensource.org/licenses/MIT). For more info, You can take a look at the [License File](LICENSE)