-
-
Notifications
You must be signed in to change notification settings - Fork 0
Mail Templates
Read mail template definitions in Teamleader Focus.
Mail templates are the email layouts used when sending invoices, quotations, work orders, and credit notes to customers. This resource is read-only β templates are configured in the Teamleader Focus web interface.
Access via Teamleader::mailTemplates().
list()throws withouttypeβ it is required, not optional. Passing a missing or invalid type throwsInvalidArgumentExceptionbefore the request.No pagination.
list()returns all matching templates in a single response.
mailTemplates
| Capability | Supported |
|---|---|
| Pagination | β Not supported |
| Filtering | β
Supported (type required, department_id optional) |
| Sorting | β Not supported |
| Sideloading | β Not supported |
| Creation | β Not supported |
| Update | β Not supported |
| Deletion | β Not supported |
type is required β throws InvalidArgumentException if absent or invalid.
use McoreServices\TeamleaderSDK\Facades\Teamleader;
// All invoice templates
$templates = Teamleader::mailTemplates()->list(['type' => 'invoice']);
// Quotation templates for a specific department
$templates = Teamleader::mailTemplates()->list([
'type' => 'quotation',
'department_id' => 'dept-uuid',
]);Teamleader::mailTemplates()->forInvoices();
Teamleader::mailTemplates()->forQuotations();
Teamleader::mailTemplates()->forWorkOrders();
Teamleader::mailTemplates()->forCreditNotes();
// With department filter
Teamleader::mailTemplates()->forInvoices('dept-uuid');Type validated before the request.
$templates = Teamleader::mailTemplates()->forType('invoice');
$templates = Teamleader::mailTemplates()->forType('credit_note', 'dept-uuid');Client-side β calls list() then searches in PHP. Returns the first match or null.
$template = Teamleader::mailTemplates()->findByName('Send link in English', 'invoice');Returns [id => name] map for dropdowns.
$options = Teamleader::mailTemplates()->asOptions('invoice');
// ['uuid-1' => 'Default Invoice', 'uuid-2' => 'Invoice β Dutch']Returns templates grouped by language code.
$grouped = Teamleader::mailTemplates()->groupByLanguage('invoice');
// ['en' => [...], 'nl' => [...]]| Type | Description |
|---|---|
invoice |
Invoice email templates |
quotation |
Quotation email templates |
work_order |
Work order email templates |
credit_note |
Credit note email templates |
[
'data' => [
[
'id' => 'template-uuid',
'type' => 'invoice',
'name' => 'Send link in English',
'language' => 'en',
'department' => ['type' => 'department', 'id' => 'dept-uuid'], // nullable
'content' => [
'subject' => 'Your invoice #INVOICE_NUMBER',
'body' => '<p>Dear #CUSTOMER_NAME, ...</p>',
],
],
],
]// Pick a template for sending an invoice
$template = Teamleader::mailTemplates()->findByName('Standard Invoice', 'invoice');
if (!$template) {
$templates = Teamleader::mailTemplates()->forInvoices();
$template = $templates['data'][0]; // fall back to first available
}
$templateId = $template['id'];use InvalidArgumentException;
// Missing type
try {
Teamleader::mailTemplates()->list(['department_id' => 'dept-uuid']);
} catch (InvalidArgumentException $e) {
// 'type is required for mail templates. Must be one of: invoice, quotation, work_order, credit_note'
}
// Invalid type
try {
Teamleader::mailTemplates()->list(['type' => 'purchase_order']);
} catch (InvalidArgumentException $e) {
// 'Invalid template type: purchase_order. Must be one of: ...'
}-
Invoices β
mail_template_idused when sending invoices -
Quotations β
mail_template_idused when sending quotations -
Credit Notes β
mail_template_idused when sending credit notes
Last Updated: August 2026 β’ SDK Version: 2.2.2 β’ Made with β€οΈ by MCore Services
- Departments
- Users
- Teams
- Custom Fields
- Work Types
- Document Templates
- Currencies
- Notes
- Email Tracking
- Closing Days
- Day Off Types
- Days Off
- User Schedules
- Invoices
- Credit Notes
- Subscriptions
- Payment Methods
- Payment Terms
- Tax Rates
- Withholding Tax Rates
- Commercial Discounts
Next Gen Projects
Legacy Projects