Skip to main content

Email Templates

Create and manage reusable email templates for consistent branding and efficient email creation.

Creating Templates

Basic Template

const template = await sendmator.templates.create({
name: 'welcome-email',
subject: 'Welcome to {{app_name}}!',
html: `
<h1>Welcome, {{user_name}}!</h1>
<p>Thanks for joining {{app_name}}.</p>
`,
variables: ['user_name', 'app_name']
});

Using Templates

await sendmator.emails.send({
to: 'user@example.com',
template: 'welcome-email',
template_data: {
user_name: 'John Doe',
app_name: 'YourApp'
}
});

Template Best Practices

  1. Use descriptive names
  2. Include fallback text versions
  3. Test with sample data
  4. Keep variables consistent