mailisk 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,12 +6,48 @@ Mailisk is an end-to-end email and SMS testing platform. It allows you to receiv
6
6
  - Easily automate E2E password reset and account verification by catching emails.
7
7
  - Receive SMS messages and automate SMS tests.
8
8
  - Generate TOTP authenticator codes and manage saved TOTP devices.
9
- - Virtual SMTP and SMS support to test without 3rd party clients.
9
+ - Outbound email and virtual SMS support to test without 3rd party clients.
10
10
 
11
11
  ## Get started
12
12
 
13
13
  For a more step-by-step walkthrough see the [NodeJS Guide](https://docs.mailisk.com/guides/nodejs.html).
14
14
 
15
+ - [Mailisk Node Client](#mailisk-node-client)
16
+ - [Get started](#get-started)
17
+ - [Requirements](#requirements)
18
+ - [Installation](#installation)
19
+ - [Install with npm](#install-with-npm)
20
+ - [Install with Yarn](#install-with-yarn)
21
+ - [Usage](#usage)
22
+ - [API Reference](#api-reference)
23
+ - [Client functions (Email)](#client-functions-email)
24
+ - [`searchInbox(namespace, params?, requestOptions?)`](#searchinboxnamespace-params-requestoptions)
25
+ - [Quick examples](#quick-examples)
26
+ - [Filter by destination address](#filter-by-destination-address)
27
+ - [`listNamespaces()`](#listnamespaces)
28
+ - [`getAttachment(attachmentId)`](#getattachmentattachmentid)
29
+ - [`downloadAttachment(attachmentId)`](#downloadattachmentattachmentid)
30
+ - [Quick examples](#quick-examples-1)
31
+ - [Client functions (Outbound Email)](#client-functions-outbound-email)
32
+ - [`sendEmail(namespace, params)`](#sendemailnamespace-params)
33
+ - [`getOutboundEmail(outboundEmailId)`](#getoutboundemailoutboundemailid)
34
+ - [`replyToEmail(emailId, params)`](#replytoemailemailid-params)
35
+ - [`forwardEmail(emailId, params)`](#forwardemailemailid-params)
36
+ - [Client functions (SMS)](#client-functions-sms)
37
+ - [`searchSmsMessages(phoneNumber, params?, requestOptions?)`](#searchsmsmessagesphonenumber-params-requestoptions)
38
+ - [Quick examples](#quick-examples-2)
39
+ - [`listSmsNumbers()`](#listsmsnumbers)
40
+ - [`sendVirtualSms(params)`](#sendvirtualsmsparams)
41
+ - [Client functions (TOTP)](#client-functions-totp)
42
+ - [`listTotpDevices(params?)`](#listtotpdevicesparams)
43
+ - [`createTotpDevice(params)`](#createtotpdeviceparams)
44
+ - [`createCustomTotpDevice(params)`](#createcustomtotpdeviceparams)
45
+ - [`createTotpDeviceFromBase32SecretKey(params)`](#createtotpdevicefrombase32secretkeyparams)
46
+ - [`createTotpDeviceFromOtpAuthUrl(params)`](#createtotpdevicefromotpauthurlparams)
47
+ - [`getTotpOtpBySharedSecret(sharedSecret, params?)`](#gettotpotpbysharedsecretsharedsecret-params)
48
+ - [`getTotpOtpByDeviceId(deviceId, params?)`](#gettotpotpbydeviceiddeviceid-params)
49
+ - [`deleteTotpDevice(deviceId)`](#deletetotpdevicedeviceid)
50
+
15
51
  ### Requirements
16
52
 
17
53
  - Node.js 18 or newer
@@ -40,10 +76,9 @@ const { MailiskClient } = require("mailisk");
40
76
  // create client
41
77
  const mailisk = new MailiskClient({ apiKey: "YOUR_API_KEY" });
42
78
 
43
- // send email (using virtual SMTP)
44
- await mailisk.sendVirtualEmail(namespace, {
45
- from: "test@example.com",
46
- to: `john@${namespace}.mailisk.net`,
79
+ // send outbound email
80
+ await mailisk.sendEmail(namespace, {
81
+ to: ["verified@example.com"],
47
82
  subject: "Testing",
48
83
  text: "This is a test.",
49
84
  });
@@ -96,21 +131,6 @@ const { data: emails } = await mailisk.searchInbox(namespace, {
96
131
  });
97
132
  ```
98
133
 
99
- ### sendVirtualEmail(namespace, params)
100
-
101
- Send an email using [Virtual SMTP](https://docs.mailisk.com/smtp.html). This will fetch the SMTP settings for the selected namespace and send an email. These emails can only be sent to an address that ends in `@{namespace}.mailisk.net`.
102
-
103
- ```js
104
- const namespace = "mynamespace";
105
-
106
- await mailisk.sendVirtualEmail(namespace, {
107
- from: "test@example.com",
108
- to: `john@${namespace}.mailisk.net`,
109
- subject: "This is a test",
110
- text: "Testing",
111
- });
112
- ```
113
-
114
134
  ### `listNamespaces()`
115
135
 
116
136
  List all namespaces associated with the current API Key.
@@ -163,6 +183,89 @@ const fileStream = fs.createWriteStream(filename);
163
183
  await new Promise((ok, err) => res.body.pipe(fileStream).on("finish", ok).on("error", err));
164
184
  ```
165
185
 
186
+ ## Client functions (Outbound Email)
187
+
188
+ Outbound email methods call the Mailisk API to create, queue, and inspect email delivery.
189
+
190
+ ### `sendEmail(namespace, params)`
191
+
192
+ Create and queue a new outbound email from a namespace. Recipients must be verified external destinations or addresses under the same namespace. Messages sent only to the same namespace do not consume outbound usage because they are counted as inbound email when delivered.
193
+
194
+ ```js
195
+ const outboundEmail = await mailisk.sendEmail("mynamespace", {
196
+ from: {
197
+ email: "support@mynamespace.mailisk.net",
198
+ name: "Support",
199
+ },
200
+ to: ["verified@example.com"],
201
+ subject: "Hello from Mailisk",
202
+ text: "This is the plain text body.",
203
+ html: "<p>This is the HTML body.</p>",
204
+ });
205
+
206
+ console.log(outboundEmail.id, outboundEmail.status);
207
+ ```
208
+
209
+ Attachments use base64 encoded content:
210
+
211
+ ```js
212
+ const fs = require("node:fs");
213
+ const attachmentContent = fs.readFileSync("report.txt");
214
+
215
+ await mailisk.sendEmail("mynamespace", {
216
+ to: ["verified@example.com"],
217
+ subject: "Report",
218
+ text: "Attached.",
219
+ attachments: [
220
+ {
221
+ filename: "report.txt",
222
+ content_type: "application/octet-stream",
223
+ content_base64: attachmentContent.toString("base64"),
224
+ },
225
+ ],
226
+ });
227
+ ```
228
+
229
+ ### `getOutboundEmail(outboundEmailId)`
230
+
231
+ Fetch the current delivery state for an outbound email, including recipient delivery statuses and provider events.
232
+
233
+ ```js
234
+ const outboundEmail = await mailisk.getOutboundEmail(outboundEmailId);
235
+
236
+ console.log(outboundEmail.delivery_summary.delivered);
237
+ console.log(outboundEmail.recipients);
238
+ ```
239
+
240
+ ### `replyToEmail(emailId, params)`
241
+
242
+ Create and queue a reply to an inbound email returned by `searchInbox`. Mailisk derives the reply recipient and threading headers from the source email.
243
+
244
+ ```js
245
+ const { data: emails } = await mailisk.searchInbox("mynamespace", {
246
+ to_addr_prefix: "support@mynamespace.mailisk.net",
247
+ });
248
+
249
+ const reply = await mailisk.replyToEmail(emails[0].id, {
250
+ text: "Thanks, we received your message.",
251
+ });
252
+
253
+ console.log(reply.id);
254
+ ```
255
+
256
+ ### `forwardEmail(emailId, params)`
257
+
258
+ Create and queue a forwarded copy of an inbound email.
259
+
260
+ ```js
261
+ const forwarded = await mailisk.forwardEmail(emailId, {
262
+ to: ["verified@example.com"],
263
+ text: "Forwarding this along.",
264
+ });
265
+
266
+ console.log(forwarded.id);
267
+ ```
268
+
166
269
  ## Client functions (SMS)
167
270
 
168
271
  ### `searchSmsMessages(phoneNumber, params?, requestOptions?)`
@@ -192,7 +295,7 @@ await mailisk.searchSmsMessages(phoneNumber, {
192
295
  await mailisk.searchSmsMessages(
193
296
  phoneNumber,
194
297
  { wait: false, limit: 10, from_date: new Date(Date.now() - 1000 * 60 * 5).toISOString() },
195
- { timeout: 10_000 }
298
+ { timeout: 10_000 },
196
299
  );
197
300
  ```
198
301
 
@@ -220,8 +323,6 @@ await mailisk.sendVirtualSms({
220
323
 
221
324
  TOTP methods call the Mailisk API to generate codes and manage saved authenticator devices. The client does not generate TOTP codes locally.
222
325
 
223
- These endpoints require an organisation API key, prefixed with `sk_org_`.
224
-
225
326
  ### `listTotpDevices(params?)`
226
327
 
227
328
  List active saved TOTP devices.
package/dist/index.d.mts CHANGED
@@ -231,6 +231,179 @@ interface SendVirtualSmsParams {
231
231
  /** The body of the SMS message */
232
232
  body: string;
233
233
  }
234
+ type OutboundEmailType = "new" | "reply" | "forward";
235
+ type OutboundEmailStatus = "queued" | "sending" | "sent" | "failed";
236
+ type OutboundEmailRecipientType = "to" | "cc" | "bcc";
237
+ type OutboundEmailRecipientDeliveryStatus = "pending" | "accepted" | "queued" | "sent" | "delayed" | "deferred" | "delivered" | "bounced" | "expired" | "complained" | "unsubscribed" | "suppressed" | "rejected" | "failed" | "cancelled";
238
+ type OutboundEmailEventType = "accepted" | "queued" | "sent" | "failed" | "rejected" | "delayed" | "deferred" | "delivered" | "bounced" | "expired" | "complained" | "unsubscribed" | "suppressed" | "cancelled" | "opened" | "clicked";
239
+ type OutboundEmailAttachmentDisposition = "attachment" | "inline";
240
+ interface OutboundEmailAddress {
241
+ /** Email address */
242
+ email: string;
243
+ /** Display name, if one is specified */
244
+ name?: string;
245
+ }
246
+ interface OutboundEmailAttachment {
247
+ /** Filename of the attachment */
248
+ filename: string;
249
+ /** MIME content type */
250
+ content_type: string;
251
+ /** Base64 encoded attachment content */
252
+ content_base64: string;
253
+ /** Content-ID for inline attachments */
254
+ content_id?: string;
255
+ /** Attachment disposition */
256
+ disposition?: OutboundEmailAttachmentDisposition;
257
+ }
258
+ interface SendEmailParams {
259
+ /** Optional sender override. Must belong to the requested namespace. */
260
+ from?: OutboundEmailAddress;
261
+ /** Optional Reply-To address */
262
+ reply_to?: OutboundEmailAddress;
263
+ /** Primary recipients */
264
+ to?: string[];
265
+ /** Carbon-copied recipients */
266
+ cc?: string[];
267
+ /** Blind carbon-copied recipients */
268
+ bcc?: string[];
269
+ /** Email subject */
270
+ subject: string;
271
+ /** HTML message body */
272
+ html?: string;
273
+ /** Plain text message body */
274
+ text?: string;
275
+ /** Attachments to include */
276
+ attachments?: OutboundEmailAttachment[];
277
+ }
278
+ interface ReplyToEmailParams {
279
+ /** Optional sender override. Must belong to the source email namespace. */
280
+ from?: OutboundEmailAddress;
281
+ /** Carbon-copied recipients */
282
+ cc?: string[];
283
+ /** Blind carbon-copied recipients */
284
+ bcc?: string[];
285
+ /** Optional subject. Defaults to Re: original subject. */
286
+ subject?: string;
287
+ /** HTML reply body */
288
+ html?: string;
289
+ /** Plain text reply body */
290
+ text?: string;
291
+ /** Attachments to include */
292
+ attachments?: OutboundEmailAttachment[];
293
+ }
294
+ interface ForwardEmailParams {
295
+ /** Optional sender override. Must belong to the source email namespace. */
296
+ from?: OutboundEmailAddress;
297
+ /** Primary recipients */
298
+ to: string[];
299
+ /** Carbon-copied recipients */
300
+ cc?: string[];
301
+ /** Blind carbon-copied recipients */
302
+ bcc?: string[];
303
+ /** Optional subject. Defaults to Fwd: original subject. */
304
+ subject?: string;
305
+ /** Optional HTML body to prepend before the forwarded message */
306
+ html?: string;
307
+ /** Optional plain text body to prepend before the forwarded message */
308
+ text?: string;
309
+ }
310
+ interface OutboundEmailResponse {
311
+ id: string;
312
+ organisation_id: string;
313
+ type: OutboundEmailType;
314
+ status: OutboundEmailStatus;
315
+ from: OutboundEmailAddress;
316
+ reply_to?: OutboundEmailAddress;
317
+ subject: string;
318
+ recipient_count: number;
319
+ attachment_count: number;
320
+ message_id: string;
321
+ provider?: string;
322
+ provider_message_id?: string;
323
+ failure_reason?: string;
324
+ queued_at: string;
325
+ sending_at?: string;
326
+ sent_at?: string;
327
+ failed_at?: string;
328
+ created_at: string;
329
+ updated_at: string;
330
+ }
331
+ interface OutboundEmailDeliverySummary {
332
+ pending: number;
333
+ accepted: number;
334
+ queued: number;
335
+ sent: number;
336
+ delayed: number;
337
+ deferred: number;
338
+ delivered: number;
339
+ bounced: number;
340
+ expired: number;
341
+ complained: number;
342
+ unsubscribed: number;
343
+ suppressed: number;
344
+ rejected: number;
345
+ failed: number;
346
+ cancelled: number;
347
+ }
348
+ interface OutboundEmailRecipient {
349
+ id: string;
350
+ type: OutboundEmailRecipientType;
351
+ email: string;
352
+ name?: string;
353
+ delivery_status: OutboundEmailRecipientDeliveryStatus;
354
+ last_event_type?: string;
355
+ last_event_at?: string;
356
+ accepted_at?: string;
357
+ queued_at?: string;
358
+ sent_at?: string;
359
+ delayed_at?: string;
360
+ deferred_at?: string;
361
+ delivered_at?: string;
362
+ bounced_at?: string;
363
+ expired_at?: string;
364
+ complained_at?: string;
365
+ unsubscribed_at?: string;
366
+ suppressed_at?: string;
367
+ rejected_at?: string;
368
+ failed_at?: string;
369
+ cancelled_at?: string;
370
+ last_smtp_code?: string;
371
+ last_enhanced_status_code?: string;
372
+ last_smtp_response?: string;
373
+ attempt_count: number;
374
+ bounce_type?: string;
375
+ bounce_subtype?: string;
376
+ bounce_classification?: string;
377
+ complaint_feedback_type?: string;
378
+ }
379
+ interface OutboundEmailEventRecipient {
380
+ id: string;
381
+ outbound_email_recipient_id?: string;
382
+ email: string;
383
+ smtp_code?: string;
384
+ enhanced_status_code?: string;
385
+ smtp_response?: string;
386
+ diagnostic_code?: string;
387
+ action?: string;
388
+ attempt_count?: number;
389
+ bounce_classification?: string;
390
+ }
391
+ interface OutboundEmailEvent {
392
+ id: string;
393
+ provider: string;
394
+ provider_message_id?: string;
395
+ provider_event_id?: string;
396
+ event_type: OutboundEmailEventType;
397
+ event_subtype?: string;
398
+ occurred_at: string;
399
+ recipients: OutboundEmailEventRecipient[];
400
+ created_at: string;
401
+ }
402
+ interface OutboundEmailDetailResponse extends OutboundEmailResponse {
403
+ delivery_summary: OutboundEmailDeliverySummary;
404
+ recipients: OutboundEmailRecipient[];
405
+ events: OutboundEmailEvent[];
406
+ }
234
407
  type TotpAlgorithm = "SHA1" | "SHA256" | "SHA512";
235
408
  type KnownTotpDeviceSource = "shared_secret" | "custom" | "base32_secret_key" | "otpauth_url";
236
409
  type TotpDeviceSource = KnownTotpDeviceSource | (string & {});
@@ -362,6 +535,32 @@ declare class MailiskClient {
362
535
  */
363
536
  listSmsNumbers(): Promise<ListSmsNumbersResponse>;
364
537
  sendVirtualSms(params: SendVirtualSmsParams): Promise<void>;
538
+ /**
539
+ * Create and queue a new outbound email from a namespace.
540
+ *
541
+ * @example
542
+ * Send an outbound email
543
+ * ```typescript
544
+ * const email = await client.sendEmail("mynamespace", {
545
+ * to: ["verified@example.com"],
546
+ * subject: "Hello",
547
+ * text: "Hello from Mailisk",
548
+ * });
549
+ * ```
550
+ */
551
+ sendEmail(namespace: string, params: SendEmailParams): Promise<OutboundEmailResponse>;
552
+ /**
553
+ * Get current delivery state for an outbound email.
554
+ */
555
+ getOutboundEmail(outboundEmailId: string): Promise<OutboundEmailDetailResponse>;
556
+ /**
557
+ * Create and queue a reply to an inbound email.
558
+ */
559
+ replyToEmail(emailId: string, params: ReplyToEmailParams): Promise<OutboundEmailResponse>;
560
+ /**
561
+ * Create and queue a forwarded copy of an inbound email.
562
+ */
563
+ forwardEmail(emailId: string, params: ForwardEmailParams): Promise<OutboundEmailResponse>;
365
564
  /**
366
565
  * List saved TOTP devices.
367
566
  *
@@ -475,6 +674,8 @@ declare class MailiskClient {
475
674
  *
476
675
  * These emails can only be sent to valid Mailisk namespaces, i.e. emails that end in @mynamespace.mailisk.net
477
676
  *
677
+ * @deprecated Use sendEmail(namespace, params) for outbound email. This method remains available for existing Virtual SMTP tests.
678
+ *
478
679
  * @example
479
680
  * For example, sending a test email:
480
681
  * ```typescript
@@ -522,6 +723,8 @@ declare class MailiskClient {
522
723
  searchInbox(namespace: string, params?: SearchInboxParams, config?: AxiosRequestConfig): Promise<SearchInboxResponse>;
523
724
  /**
524
725
  * Get the SMTP settings for a namespace.
726
+ *
727
+ * @deprecated Virtual SMTP is deprecated. Use sendEmail(namespace, params) for outbound email instead.
525
728
  */
526
729
  getSmtpSettings(namespace: string): Promise<SmtpSettings>;
527
730
  getAttachment(attachmentId: string): Promise<GetAttachmentResponse>;
@@ -541,4 +744,4 @@ declare class MailiskClient {
541
744
  downloadAttachment(attachmentId: string): Promise<Buffer>;
542
745
  }
543
746
 
544
- export { type CreateBase32SecretKeyTotpDeviceParams, type CreateCustomTotpDeviceParams, type CreateOtpAuthUrlTotpDeviceParams, type CreateTotpDeviceParams, type Email, type EmailAddress, type EmailAttachment, type GetAttachmentResponse, type GetTotpOtpParams, type KnownTotpDeviceSource, type ListNamespacesResponse, type ListSmsNumbersResponse, type ListTotpDevicesParams, type ListTotpDevicesResponse, MailiskClient, type SearchInboxParams, type SearchInboxResponse, type SearchSmsMessagesParams, type SearchSmsMessagesResponse, type SendVirtualEmailParams, type SendVirtualSmsParams, type SmsMessage, type SmsNumber, type SmtpSettings, type TotpAlgorithm, type TotpDevice, type TotpDeviceSource, type TotpOtpResponse };
747
+ export { type CreateBase32SecretKeyTotpDeviceParams, type CreateCustomTotpDeviceParams, type CreateOtpAuthUrlTotpDeviceParams, type CreateTotpDeviceParams, type Email, type EmailAddress, type EmailAttachment, type ForwardEmailParams, type GetAttachmentResponse, type GetTotpOtpParams, type KnownTotpDeviceSource, type ListNamespacesResponse, type ListSmsNumbersResponse, type ListTotpDevicesParams, type ListTotpDevicesResponse, MailiskClient, type OutboundEmailAddress, type OutboundEmailAttachment, type OutboundEmailAttachmentDisposition, type OutboundEmailDeliverySummary, type OutboundEmailDetailResponse, type OutboundEmailEvent, type OutboundEmailEventRecipient, type OutboundEmailEventType, type OutboundEmailRecipient, type OutboundEmailRecipientDeliveryStatus, type OutboundEmailRecipientType, type OutboundEmailResponse, type OutboundEmailStatus, type OutboundEmailType, type ReplyToEmailParams, type SearchInboxParams, type SearchInboxResponse, type SearchSmsMessagesParams, type SearchSmsMessagesResponse, type SendEmailParams, type SendVirtualEmailParams, type SendVirtualSmsParams, type SmsMessage, type SmsNumber, type SmtpSettings, type TotpAlgorithm, type TotpDevice, type TotpDeviceSource, type TotpOtpResponse };
package/dist/index.d.ts CHANGED
@@ -231,6 +231,179 @@ interface SendVirtualSmsParams {
231
231
  /** The body of the SMS message */
232
232
  body: string;
233
233
  }
234
+ type OutboundEmailType = "new" | "reply" | "forward";
235
+ type OutboundEmailStatus = "queued" | "sending" | "sent" | "failed";
236
+ type OutboundEmailRecipientType = "to" | "cc" | "bcc";
237
+ type OutboundEmailRecipientDeliveryStatus = "pending" | "accepted" | "queued" | "sent" | "delayed" | "deferred" | "delivered" | "bounced" | "expired" | "complained" | "unsubscribed" | "suppressed" | "rejected" | "failed" | "cancelled";
238
+ type OutboundEmailEventType = "accepted" | "queued" | "sent" | "failed" | "rejected" | "delayed" | "deferred" | "delivered" | "bounced" | "expired" | "complained" | "unsubscribed" | "suppressed" | "cancelled" | "opened" | "clicked";
239
+ type OutboundEmailAttachmentDisposition = "attachment" | "inline";
240
+ interface OutboundEmailAddress {
241
+ /** Email address */
242
+ email: string;
243
+ /** Display name, if one is specified */
244
+ name?: string;
245
+ }
246
+ interface OutboundEmailAttachment {
247
+ /** Filename of the attachment */
248
+ filename: string;
249
+ /** MIME content type */
250
+ content_type: string;
251
+ /** Base64 encoded attachment content */
252
+ content_base64: string;
253
+ /** Content-ID for inline attachments */
254
+ content_id?: string;
255
+ /** Attachment disposition */
256
+ disposition?: OutboundEmailAttachmentDisposition;
257
+ }
258
+ interface SendEmailParams {
259
+ /** Optional sender override. Must belong to the requested namespace. */
260
+ from?: OutboundEmailAddress;
261
+ /** Optional Reply-To address */
262
+ reply_to?: OutboundEmailAddress;
263
+ /** Primary recipients */
264
+ to?: string[];
265
+ /** Carbon-copied recipients */
266
+ cc?: string[];
267
+ /** Blind carbon-copied recipients */
268
+ bcc?: string[];
269
+ /** Email subject */
270
+ subject: string;
271
+ /** HTML message body */
272
+ html?: string;
273
+ /** Plain text message body */
274
+ text?: string;
275
+ /** Attachments to include */
276
+ attachments?: OutboundEmailAttachment[];
277
+ }
278
+ interface ReplyToEmailParams {
279
+ /** Optional sender override. Must belong to the source email namespace. */
280
+ from?: OutboundEmailAddress;
281
+ /** Carbon-copied recipients */
282
+ cc?: string[];
283
+ /** Blind carbon-copied recipients */
284
+ bcc?: string[];
285
+ /** Optional subject. Defaults to Re: original subject. */
286
+ subject?: string;
287
+ /** HTML reply body */
288
+ html?: string;
289
+ /** Plain text reply body */
290
+ text?: string;
291
+ /** Attachments to include */
292
+ attachments?: OutboundEmailAttachment[];
293
+ }
294
+ interface ForwardEmailParams {
295
+ /** Optional sender override. Must belong to the source email namespace. */
296
+ from?: OutboundEmailAddress;
297
+ /** Primary recipients */
298
+ to: string[];
299
+ /** Carbon-copied recipients */
300
+ cc?: string[];
301
+ /** Blind carbon-copied recipients */
302
+ bcc?: string[];
303
+ /** Optional subject. Defaults to Fwd: original subject. */
304
+ subject?: string;
305
+ /** Optional HTML body to prepend before the forwarded message */
306
+ html?: string;
307
+ /** Optional plain text body to prepend before the forwarded message */
308
+ text?: string;
309
+ }
310
+ interface OutboundEmailResponse {
311
+ id: string;
312
+ organisation_id: string;
313
+ type: OutboundEmailType;
314
+ status: OutboundEmailStatus;
315
+ from: OutboundEmailAddress;
316
+ reply_to?: OutboundEmailAddress;
317
+ subject: string;
318
+ recipient_count: number;
319
+ attachment_count: number;
320
+ message_id: string;
321
+ provider?: string;
322
+ provider_message_id?: string;
323
+ failure_reason?: string;
324
+ queued_at: string;
325
+ sending_at?: string;
326
+ sent_at?: string;
327
+ failed_at?: string;
328
+ created_at: string;
329
+ updated_at: string;
330
+ }
331
+ interface OutboundEmailDeliverySummary {
332
+ pending: number;
333
+ accepted: number;
334
+ queued: number;
335
+ sent: number;
336
+ delayed: number;
337
+ deferred: number;
338
+ delivered: number;
339
+ bounced: number;
340
+ expired: number;
341
+ complained: number;
342
+ unsubscribed: number;
343
+ suppressed: number;
344
+ rejected: number;
345
+ failed: number;
346
+ cancelled: number;
347
+ }
348
+ interface OutboundEmailRecipient {
349
+ id: string;
350
+ type: OutboundEmailRecipientType;
351
+ email: string;
352
+ name?: string;
353
+ delivery_status: OutboundEmailRecipientDeliveryStatus;
354
+ last_event_type?: string;
355
+ last_event_at?: string;
356
+ accepted_at?: string;
357
+ queued_at?: string;
358
+ sent_at?: string;
359
+ delayed_at?: string;
360
+ deferred_at?: string;
361
+ delivered_at?: string;
362
+ bounced_at?: string;
363
+ expired_at?: string;
364
+ complained_at?: string;
365
+ unsubscribed_at?: string;
366
+ suppressed_at?: string;
367
+ rejected_at?: string;
368
+ failed_at?: string;
369
+ cancelled_at?: string;
370
+ last_smtp_code?: string;
371
+ last_enhanced_status_code?: string;
372
+ last_smtp_response?: string;
373
+ attempt_count: number;
374
+ bounce_type?: string;
375
+ bounce_subtype?: string;
376
+ bounce_classification?: string;
377
+ complaint_feedback_type?: string;
378
+ }
379
+ interface OutboundEmailEventRecipient {
380
+ id: string;
381
+ outbound_email_recipient_id?: string;
382
+ email: string;
383
+ smtp_code?: string;
384
+ enhanced_status_code?: string;
385
+ smtp_response?: string;
386
+ diagnostic_code?: string;
387
+ action?: string;
388
+ attempt_count?: number;
389
+ bounce_classification?: string;
390
+ }
391
+ interface OutboundEmailEvent {
392
+ id: string;
393
+ provider: string;
394
+ provider_message_id?: string;
395
+ provider_event_id?: string;
396
+ event_type: OutboundEmailEventType;
397
+ event_subtype?: string;
398
+ occurred_at: string;
399
+ recipients: OutboundEmailEventRecipient[];
400
+ created_at: string;
401
+ }
402
+ interface OutboundEmailDetailResponse extends OutboundEmailResponse {
403
+ delivery_summary: OutboundEmailDeliverySummary;
404
+ recipients: OutboundEmailRecipient[];
405
+ events: OutboundEmailEvent[];
406
+ }
234
407
  type TotpAlgorithm = "SHA1" | "SHA256" | "SHA512";
235
408
  type KnownTotpDeviceSource = "shared_secret" | "custom" | "base32_secret_key" | "otpauth_url";
236
409
  type TotpDeviceSource = KnownTotpDeviceSource | (string & {});
@@ -362,6 +535,32 @@ declare class MailiskClient {
362
535
  */
363
536
  listSmsNumbers(): Promise<ListSmsNumbersResponse>;
364
537
  sendVirtualSms(params: SendVirtualSmsParams): Promise<void>;
538
+ /**
539
+ * Create and queue a new outbound email from a namespace.
540
+ *
541
+ * @example
542
+ * Send an outbound email
543
+ * ```typescript
544
+ * const email = await client.sendEmail("mynamespace", {
545
+ * to: ["verified@example.com"],
546
+ * subject: "Hello",
547
+ * text: "Hello from Mailisk",
548
+ * });
549
+ * ```
550
+ */
551
+ sendEmail(namespace: string, params: SendEmailParams): Promise<OutboundEmailResponse>;
552
+ /**
553
+ * Get current delivery state for an outbound email.
554
+ */
555
+ getOutboundEmail(outboundEmailId: string): Promise<OutboundEmailDetailResponse>;
556
+ /**
557
+ * Create and queue a reply to an inbound email.
558
+ */
559
+ replyToEmail(emailId: string, params: ReplyToEmailParams): Promise<OutboundEmailResponse>;
560
+ /**
561
+ * Create and queue a forwarded copy of an inbound email.
562
+ */
563
+ forwardEmail(emailId: string, params: ForwardEmailParams): Promise<OutboundEmailResponse>;
365
564
  /**
366
565
  * List saved TOTP devices.
367
566
  *
@@ -475,6 +674,8 @@ declare class MailiskClient {
475
674
  *
476
675
  * These emails can only be sent to valid Mailisk namespaces, i.e. emails that end in @mynamespace.mailisk.net
477
676
  *
677
+ * @deprecated Use sendEmail(namespace, params) for outbound email. This method remains available for existing Virtual SMTP tests.
678
+ *
478
679
  * @example
479
680
  * For example, sending a test email:
480
681
  * ```typescript
@@ -522,6 +723,8 @@ declare class MailiskClient {
522
723
  searchInbox(namespace: string, params?: SearchInboxParams, config?: AxiosRequestConfig): Promise<SearchInboxResponse>;
523
724
  /**
524
725
  * Get the SMTP settings for a namespace.
726
+ *
727
+ * @deprecated Virtual SMTP is deprecated. Use sendEmail(namespace, params) for outbound email instead.
525
728
  */
526
729
  getSmtpSettings(namespace: string): Promise<SmtpSettings>;
527
730
  getAttachment(attachmentId: string): Promise<GetAttachmentResponse>;
@@ -541,4 +744,4 @@ declare class MailiskClient {
541
744
  downloadAttachment(attachmentId: string): Promise<Buffer>;
542
745
  }
543
746
 
544
- export { type CreateBase32SecretKeyTotpDeviceParams, type CreateCustomTotpDeviceParams, type CreateOtpAuthUrlTotpDeviceParams, type CreateTotpDeviceParams, type Email, type EmailAddress, type EmailAttachment, type GetAttachmentResponse, type GetTotpOtpParams, type KnownTotpDeviceSource, type ListNamespacesResponse, type ListSmsNumbersResponse, type ListTotpDevicesParams, type ListTotpDevicesResponse, MailiskClient, type SearchInboxParams, type SearchInboxResponse, type SearchSmsMessagesParams, type SearchSmsMessagesResponse, type SendVirtualEmailParams, type SendVirtualSmsParams, type SmsMessage, type SmsNumber, type SmtpSettings, type TotpAlgorithm, type TotpDevice, type TotpDeviceSource, type TotpOtpResponse };
747
+ export { type CreateBase32SecretKeyTotpDeviceParams, type CreateCustomTotpDeviceParams, type CreateOtpAuthUrlTotpDeviceParams, type CreateTotpDeviceParams, type Email, type EmailAddress, type EmailAttachment, type ForwardEmailParams, type GetAttachmentResponse, type GetTotpOtpParams, type KnownTotpDeviceSource, type ListNamespacesResponse, type ListSmsNumbersResponse, type ListTotpDevicesParams, type ListTotpDevicesResponse, MailiskClient, type OutboundEmailAddress, type OutboundEmailAttachment, type OutboundEmailAttachmentDisposition, type OutboundEmailDeliverySummary, type OutboundEmailDetailResponse, type OutboundEmailEvent, type OutboundEmailEventRecipient, type OutboundEmailEventType, type OutboundEmailRecipient, type OutboundEmailRecipientDeliveryStatus, type OutboundEmailRecipientType, type OutboundEmailResponse, type OutboundEmailStatus, type OutboundEmailType, type ReplyToEmailParams, type SearchInboxParams, type SearchInboxResponse, type SearchSmsMessagesParams, type SearchSmsMessagesResponse, type SendEmailParams, type SendVirtualEmailParams, type SendVirtualSmsParams, type SmsMessage, type SmsNumber, type SmtpSettings, type TotpAlgorithm, type TotpDevice, type TotpDeviceSource, type TotpOtpResponse };