Central index of runnable example scripts demonstrating Mailtrap PHP SDK features. Each script is intentionally minimal; open the file to inspect parameters. Run examples from project root (adjust env vars first).
- Export or place inside the file your ENV variables (MAILTRAP_API_KEY, MAILTRAP_INBOX_ID, etc)
- Some examples require a verified sending domain (production / bulk / templates).
| Purpose | File |
|---|---|
| Minimal transactional send | sending/minimal.php |
| Full featured send (headers, vars, attachments) | sending/all.php |
| Send using a template (transactional stream) | sending/template.php |
| Suppressions API usage | sending/suppressions.php |
| Bulk API single send (stream selection) | bulk/bulk.php |
| Bulk API template send | bulk/bulk_template.php |
| Purpose | File |
|---|---|
| Transactional batch send | batch/transactional.php |
| Transactional batch send (template) | batch/transactional_template.php |
| Bulk batch send | batch/bulk.php |
| Bulk batch send (template) | batch/bulk_template.php |
| Sandbox batch send | batch/sandbox.php |
| Sandbox batch send (template) | batch/sandbox_template.php |
| Purpose | File |
|---|---|
| Sandbox transactional send | testing/send-mail.php |
| Sandbox send with template | testing/template.php |
| Manage attachments of a message | testing/attachments.php |
| Inbox CRUD / listing | testing/inboxes.php |
| Message CRUD / listing | testing/messages.php |
| Project CRUD / listing | testing/projects.php |
| Purpose | File |
|---|---|
| Contacts CRUD + list | contacts/all.php |
| Contact lists CRUD | contact-lists/all.php |
| Custom fields CRUD | contact-fields/all.php |
| Purpose | File |
|---|---|
| Templates CRUD | templates/all.php |
| Sending domains CRUD | sending-domains/all.php |
| Purpose | File |
|---|---|
| Accounts info | general/accounts.php |
| Billing info | general/billing.php |
| Permissions listing | general/permissions.php |
| Users listing | general/users.php |
| Framework | Files |
|---|---|
| Laravel (transactional, sandbox, template, bulk) | laravel/transactional.php, laravel/sandbox.php, laravel/template.php, laravel/bulk.php |
| Symfony (transactional, sandbox, template, bulk) | symfony/transactional.php, symfony/sandbox.php, symfony/template.php, symfony/bulk.php |
| Purpose | File |
|---|---|
| Showcase of combined config usage / initialization patterns | config/all.php |
From project root:
php examples/sending/minimal.php
For batch examples, ensure the stream (bulk vs transactional vs sandbox) matches your API token and domain verification status.
- Keep secrets out of committed files; rely on environment variables.
- Template examples require existing template UUIDs in your Mailtrap account.
- Sandbox examples need
MAILTRAP_INBOX_ID.