Локалізовано за допомогою ШІ
{
  "name": "Ваша компанія",
  "email": "hello@yourdomain.com"
}
{
  "name": "Іван Петренко", 
  "email": "ivan@example.com"
}
{
  "filename": "рахунок.pdf",
  "content": "base64-encoded-content",
  "type": "application/pdf",
  "disposition": "attachment"
}
{
  "id": "email_abc123def456",
  "status": "sent",
  "from": "hello@yourdomain.com",
  "to": ["user@example.com"],
  "subject": "Ласкаво просимо до нашого сервісу!",
  "created_at": "2024-01-15T10:30:00Z",
  "scheduled_at": null
}
{
  "id": "email_abc123def456",
  "status": "delivered",
  "from": {
    "name": "Ваша компанія",
    "email": "hello@yourdomain.com"
  },
  "to": [
    {
      "name": "Іван Петренко",
      "email": "ivan@example.com"
    }
  ],
  "subject": "Ласкаво просимо до нашого сервісу!",
  "html": "<h1>Вітаємо!</h1><p>Дякуємо за реєстрацію.</p>",
  "text": "Вітаємо!\n\nДякуємо за реєстрацію.",
  "created_at": "2024-01-15T10:30:00Z",
  "sent_at": "2024-01-15T10:30:05Z",
  "delivered_at": "2024-01-15T10:30:15Z",
  "opened_at": "2024-01-15T11:45:22Z",
  "clicks": [
    {
      "url": "https://yourdomain.com/welcome",
      "clicked_at": "2024-01-15T11:46:10Z"
    }
  ],
  "tags": ["вітання", "онбордінг"],
  "metadata": {
    "user_id": "12345",
    "campaign": "серія_вітання"
  }
}
{
  "data": [
    {
      "id": "email_abc123def456",
      "status": "delivered",
      "from": "hello@yourdomain.com",
      "to": ["ivan@example.com"],
      "subject": "Ласкаво просимо до нашого сервісу!",
      "created_at": "2024-01-15T10:30:00Z",
      "delivered_at": "2024-01-15T10:30:15Z"
    }
  ],
  "has_more": true,
  "next_cursor": "email_xyz789abc123"
}
{
  "id": "email_abc123def456",
  "status": "cancelled",
  "cancelled_at": "2024-01-15T09:15:00Z"
}
{
  "id": "email_def456ghi789",
  "original_id": "email_abc123def456",
  "status": "sent",
  "created_at": "2024-01-15T14:20:00Z"
}
{
  "error": {
    "type": "validation_error",
    "code": "invalid_email",
    "message": "Адреса електронної пошти одержувача недійсна",
    "param": "to"
  }
}
{
  "error": {
    "type": "validation_error",
    "code": "missing_required_field",
    "message": "Поле теми є обов'язковим",
    "param": "subject"
  }
}
{
  "error": {
    "type": "resource_error",
    "code": "email_not_found",
    "message": "Не знайдено лист з наданим ID"
  }
}
{
  "error": {
    "type": "rate_limit_error",
    "code": "rate_limit_exceeded",
    "message": "Занадто багато запитів. Перевищено ліміт швидкості."
  }
}
const response = await emailit.emails.send({
  from: 'welcome@yourdomain.com',
  to: 'новийкористувач@example.com',
  template: 'шаблон-вітання',
  variables: {
    name: 'Іван Петренко',
    company: 'ТОВ "Приклад"',
    activation_url: 'https://yourdomain.com/activate?token=abc123'
  }
})
const response = await emailit.emails.send({
  from: 'рахунки@yourdomain.com',
  to: 'клієнт@example.com',
  subject: 'Ваш рахунок №12345',
  html: '<p>Будь ласка, знайдіть ваш рахунок у вкладенні.</p>',
  attachments: [
    {
      filename: 'рахунок-12345.pdf',
      content: 'JVBERi0xLjQKJcOkw7zDqc...', // base64 кодування
      type: 'application/pdf'
    }
  ]
})
const response = await emailit.emails.send({
  from: 'нагадування@yourdomain.com',
  to: 'користувач@example.com',
  subject: 'Нагадування про зустріч',
  html: '<p>Ваша зустріч завтра о 14:00.</p>',
  scheduled_at: '2024-01-16T13:00:00Z' // Надіслати за годину до зустрічі
})
const emails = [
  {
    from: 'розсилка@yourdomain.com',
    to: 'користувач1@example.com',
    subject: 'Тижнева розсилка',
    template: 'розсилка',
    variables: { name: 'Аліса' }
  },
  {
    from: 'розсилка@yourdomain.com',
    to: 'користувач2@example.com', 
    subject: 'Тижнева розсилка',
    template: 'розсилка',
    variables: { name: 'Богдан' }
  }
]

const responses = await Promise.all(
  emails.map(email => emailit.emails.send(email))
)