apsonex / letmesendemail-php
LetMeSendEmail PHP library.
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/apsonex/letmesendemail-php
Requires
- php: ^8.1.0
- guzzlehttp/guzzle: ^7.5
- illuminate/http: ^12.40
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.13
- mockery/mockery: ^1.6
- pestphp/pest: ^2.0|^3.0|^4.0
- symfony/filesystem: ^8.0
- symfony/var-dumper: ^8.0
- vlucas/phpdotenv: ^5.6
This package is not auto-updated.
Last update: 2026-01-06 22:23:11 UTC
README
User following api to interact with emails
List Emails
List emails. List will return \LetMeSendEmail\ValueObject\RestResponses\Email\ListResponse instance.
For pagination, don't use before and after together. Either use before or after at a time.
$client->email()->list( limit: 20, // before: '<resource-id>', // after: '<resource-id>', );
Send Email
Send Email.
Attachment can be added in two ways. Either attach via path or inline base64 encoded file content. specify the type property to be either 'path' or 'content'
Email size can not exceed more that 40MB. For safety margin, keep size less then 38MB.
Response will be \LetMeSendEmail\ValueObject\RestResponses\Domain\StoreResponse
$client->email()->send( from: 'John Doe <john@example.com>', to: 'Jane Doe <jane@example.com>', replyTo: 'sara@example.com', cc: ['max@example.com'], bcc: ['eleven@example.com'], subject: 'Subject', html: '<p>Message</p>', text: 'Message', attachments: [ [ 'type' => 'path', 'filename' => 'image.png', 'mimeType' => 'image/png', 'contentId' => '<content-id>', 'path' => 'https://file-source-url.com', ], [ 'type' => 'content', 'filename' => 'image.png', 'mimeType' => 'image/png', 'contentId' => '<content-id>', 'content' => '<base64-encoded-file>', ], ], );
Show Email
Retrieve email by id. \LetMeSendEmail\ValueObject\RestResponses\Email\GetResponse instance will be returned
$client->email()->get( id: '<email-id>', );
Verify Email
Check if email is valid. \LetMeSendEmail\ValueObject\RestResponses\Email\VerifyResponse instance will be returned
$client->email()->verify([ 'email' => 'john@example.com' ])->valid(); // bool
Domains
User following api to interact with domains
List domains
List domains. List will return \LetMeSendEmail\ValueObject\RestResponses\Domain\ListResponse instance.
For pagination, don't use before and after together. Either use before or after at a time.
$client->domain()->list( limit: 20, // before: '<resource-id>', // after: '<resource-id>', );
Retrieve domain
Retrieve domain by ID or domain name. \LetMeSendEmail\ValueObject\RestResponses\Domain\GetResponse instance will be returned
$client->email()->get( id: '<domain-id> or <domain-name>', );
Verify Domain
Check if domain is valid. \LetMeSendEmail\ValueObject\RestResponses\Domain\VerifyResponse instance will be returned
If response is 200, we will simply mark domain verified.
In case, domain doesn't exist or un-verified, it will throw not found status code
This is useful, when you want to check users' domain status
$client->domain()->verify([ 'domain' => 'example.com' ])->verified(); // bool
Contacts
User following api to interact with contacts
List Contacts
List contacts. It will return \LetMeSendEmail\ValueObject\RestResponses\Contact\ListResponse instance.
For pagination, don't use before and after together. Either use before or after at a time.
$client->contact()->list( limit: 20, // before: '<resource-id>', // after: '<resource-id>', )->ok();
Create Contact
Create new contact.
Response will be \LetMeSendEmail\ValueObject\RestResponses\Contact\StoreResponse
$client->contact()->create( email: 'john@example.com', first_name: 'John', last_name: 'Doe', phone: +11231231234, categories: ['<category-id>'], tags: ['<tag-id>'], )->ok();
Show Contact
Retrieve single contact by id. \LetMeSendEmail\ValueObject\RestResponses\Contact\GetResponse instance will be returned
$client->contact()->get( id: '<contact-id>', )->ok();
Update Contact
Update given contact. \LetMeSendEmail\ValueObject\RestResponses\Contact\UpdateResponse instance will be returned
$client->contact()->update( id: '<contact-id>', payload: [ 'email' => 'john@example.com' ] )->updated(); // bool
Delete Contact
Remove given contact. \LetMeSendEmail\ValueObject\RestResponses\Contact\DeleteResponse instance will be returned
$client->contact()->remove( id: '<contact-id>', )->deleted(); // bool
Contact Categories
User following api to interact with contact categories
List Contact Categories
List contact categories. It will return \LetMeSendEmail\ValueObject\RestResponses\ContactCategory\ListResponse instance.
For pagination, don't use before and after together. Either use before or after at a time.
$client->contactCategory()->list( limit: 20, // before: '<resource-id>', // after: '<resource-id>', )->ok();
Create Contact Category
Create new contact category. It will create new category, if slug with same name already exists, it will update the given category
Response will be \LetMeSendEmail\ValueObject\RestResponses\ContactCategory\StoreResponse
$client->contactCategory()->create( name: 'Category Name', )->ok();
Show Contact Category
Retrieve single contact category by id. \LetMeSendEmail\ValueObject\RestResponses\ContactCategory\GetResponse instance will be returned
$client->contactCategory()->get( id: '<contact-category-id>', )->ok();
Update Contact Category
Update given contact category. \LetMeSendEmail\ValueObject\RestResponses\ContactCategory\UpdateResponse instance will be returned
$client->contactCategory()->update( id: '<category-id>', payload: [ 'name' => 'New Name', 'slug' => 'new-name', ] )->updated(); // bool
Delete Contact Category
Remove given contact category. \LetMeSendEmail\ValueObject\RestResponses\ContactCategory\DeleteResponse instance will be returned
$client->contactCategory()->remove( id: '<category-id>', )->deleted(); // bool
Contact Tags
User following api to interact with contact tags
List Contact Tags
List contact tags. It will return \LetMeSendEmail\ValueObject\RestResponses\ContactTag\ListResponse instance.
For pagination, don't use before and after together. Either use before or after at a time.
$client->contactTag()->list( limit: 20, // before: '<resource-id>', // after: '<resource-id>', )->ok();
Create Contact Tag
Create new contact tag. It will create new tag, if slug with same name already exists, it will update the given tag
Response will be \LetMeSendEmail\ValueObject\RestResponses\ContactTag\StoreResponse
$client->contactTag()->create( name: 'Tag Name', )->ok();
Show Contact Tag
Retrieve single contact tag by id. \LetMeSendEmail\ValueObject\RestResponses\ContactTag\GetResponse instance will be returned
$client->contactTag()->get( id: '<contact-tag-id>', )->ok();
Update Contact Tag
Update given contact tag. \LetMeSendEmail\ValueObject\RestResponses\ContactTag\UpdateResponse instance will be returned
$client->contactTag()->update( id: '<tag-id>', payload: [ 'name' => 'New Name', 'slug' => 'new-name', ] )->updated(); // bool
Delete Contact Tag
Remove given contact tag. \LetMeSendEmail\ValueObject\RestResponses\ContactTag\DeleteResponse instance will be returned
$client->contactTag()->remove( id: '<tag-id>', )->deleted(); // bool
Webhook
User following api to interact with webhook
Verify Incoming Webhook
You can verify incoming webhook from letmesend.email
Use the \LetMeSendEmail\Support\WebhookSignature::verify(...) to execute verification
WebhookSignature::verify( payload: '{...}', // payload string (its the body of the request) headers: [...], // request headers array secret: '123...abc', // webhook signing secret tolerance: 300, // webhook tolerance ); // bool