react-native-email-imap-smtp 0.3.3 → 0.3.5

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.
@@ -9,7 +9,10 @@
9
9
  // Web / other → web.ts → throws not-supported
10
10
  // ============================================================
11
11
 
12
- import { Platform } from 'react-native';
12
+ const {
13
+ Platform
14
+ } = require('react-native');
15
+
13
16
  // ─── Platform-aware module resolution ──────────────────────
14
17
 
15
18
  let impl;
@@ -25,57 +28,55 @@ if (Platform.OS === 'android') {
25
28
  // Web 等其他平台
26
29
  impl = require('./web');
27
30
  }
31
+ module.exports = {
32
+ // ─── IMAP exports ───────────────────────────────────────────
28
33
 
29
- // ─── IMAP exports ───────────────────────────────────────────
30
-
31
- export const imapConnect = impl.imapConnect;
32
- export const imapDisconnect = impl.imapDisconnect;
33
- export const imapListMailboxes = impl.imapListMailboxes;
34
- export const imapSelectMailbox = impl.imapSelectMailbox;
35
- export const imapRefreshMailbox = impl.imapRefreshMailbox;
36
- export const imapFetchFolders = impl.imapFetchFolders;
37
- export const imapCreateFolder = impl.imapCreateFolder;
38
- export const imapDeleteFolder = impl.imapDeleteFolder;
39
- export const imapRenameFolder = impl.imapRenameFolder;
40
- export const imapSubscribeFolder = impl.imapSubscribeFolder;
41
- export const imapUnsubscribeFolder = impl.imapUnsubscribeFolder;
42
- export const imapFetchEmails = impl.imapFetchEmails;
43
- export const imapFetchEmailByUID = impl.imapFetchEmailByUID;
44
- export const imapSearchEmails = impl.imapSearchEmails;
45
- export const imapMarkAsRead = impl.imapMarkAsRead;
46
- export const imapMarkAsFlagged = impl.imapMarkAsFlagged;
47
- export const imapMoveEmails = impl.imapMoveEmails;
48
- export const imapCopyEmails = impl.imapCopyEmails;
49
- export const imapDeleteEmails = impl.imapDeleteEmails;
50
- export const imapExpunge = impl.imapExpunge;
51
- export const imapFetchAttachments = impl.imapFetchAttachments;
52
- export const imapFetchAllAttachments = impl.imapFetchAllAttachments;
53
- export const imapIdle = impl.imapIdle;
54
- export const imapStopIdle = impl.imapStopIdle;
55
- export const imapGetQuota = impl.imapGetQuota;
56
- export const imapAppendMessage = impl.imapAppendMessage;
57
-
58
- // ─── SMTP exports ──────────────────────────────────────────
59
-
60
- export const smtpConnect = impl.smtpConnect;
61
- export const smtpDisconnect = impl.smtpDisconnect;
62
- export const smtpSendMail = impl.smtpSendMail;
63
- export const smtpVerifyConnection = impl.smtpVerifyConnection;
64
-
65
- // ─── Web 专属导出(原生平台为 undefined) ─────────────────
66
-
67
- export const setProxyUrl = impl.setProxyUrl;
68
- export const getProxyUrl = impl.getProxyUrl;
34
+ imapConnect: impl.imapConnect,
35
+ imapDisconnect: impl.imapDisconnect,
36
+ imapListMailboxes: impl.imapListMailboxes,
37
+ imapSelectMailbox: impl.imapSelectMailbox,
38
+ imapRefreshMailbox: impl.imapRefreshMailbox,
39
+ imapFetchFolders: impl.imapFetchFolders,
40
+ imapCreateFolder: impl.imapCreateFolder,
41
+ imapDeleteFolder: impl.imapDeleteFolder,
42
+ imapRenameFolder: impl.imapRenameFolder,
43
+ imapSubscribeFolder: impl.imapSubscribeFolder,
44
+ imapUnsubscribeFolder: impl.imapUnsubscribeFolder,
45
+ imapFetchEmails: impl.imapFetchEmails,
46
+ imapFetchEmailByUID: impl.imapFetchEmailByUID,
47
+ imapSearchEmails: impl.imapSearchEmails,
48
+ imapMarkAsRead: impl.imapMarkAsRead,
49
+ imapMarkAsFlagged: impl.imapMarkAsFlagged,
50
+ imapMoveEmails: impl.imapMoveEmails,
51
+ imapCopyEmails: impl.imapCopyEmails,
52
+ imapDeleteEmails: impl.imapDeleteEmails,
53
+ imapExpunge: impl.imapExpunge,
54
+ imapFetchAttachments: impl.imapFetchAttachments,
55
+ imapFetchAllAttachments: impl.imapFetchAllAttachments,
56
+ imapIdle: impl.imapIdle,
57
+ imapStopIdle: impl.imapStopIdle,
58
+ imapGetQuota: impl.imapGetQuota,
59
+ imapAppendMessage: impl.imapAppendMessage,
60
+ // ─── SMTP exports ──────────────────────────────────────────
69
61
 
70
- /**
71
- * 连接错误类,可用于 `instanceof` 检查。
72
- * Web 平台始终可用,原生平台暂未实现。
73
- */
74
- export const ImapNotConnectedError = impl.ImapNotConnectedError;
62
+ smtpConnect: impl.smtpConnect,
63
+ smtpDisconnect: impl.smtpDisconnect,
64
+ smtpSendMail: impl.smtpSendMail,
65
+ smtpVerifyConnection: impl.smtpVerifyConnection,
66
+ // ─── Web 专属导出(原生平台为 undefined) ─────────────────
75
67
 
76
- /**
77
- * SMTP 连接错误类,可用于 `instanceof` 检查。
78
- * Web 平台始终可用,原生平台暂未实现。
79
- */
80
- export const SmtpNotConnectedError = impl.SmtpNotConnectedError;
68
+ setProxyUrl: impl.setProxyUrl,
69
+ getProxyUrl: impl.getProxyUrl,
70
+ /**
71
+ * 连接错误类,可用于 `instanceof` 检查。
72
+ * Web 平台始终可用,原生平台暂未实现。
73
+ */
74
+ ImapNotConnectedError: impl.ImapNotConnectedError,
75
+ /**
76
+ * SMTP 连接错误类,可用于 `instanceof` 检查。
77
+ * Web 平台始终可用,原生平台暂未实现。
78
+ */
79
+ SmtpNotConnectedError: impl.SmtpNotConnectedError
80
+ };
81
+ export {};
81
82
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","impl","OS","require","Error","imapConnect","imapDisconnect","imapListMailboxes","imapSelectMailbox","imapRefreshMailbox","imapFetchFolders","imapCreateFolder","imapDeleteFolder","imapRenameFolder","imapSubscribeFolder","imapUnsubscribeFolder","imapFetchEmails","imapFetchEmailByUID","imapSearchEmails","imapMarkAsRead","imapMarkAsFlagged","imapMoveEmails","imapCopyEmails","imapDeleteEmails","imapExpunge","imapFetchAttachments","imapFetchAllAttachments","imapIdle","imapStopIdle","imapGetQuota","imapAppendMessage","smtpConnect","smtpDisconnect","smtpSendMail","smtpVerifyConnection","setProxyUrl","getProxyUrl","ImapNotConnectedError","SmtpNotConnectedError"],"sourceRoot":"..\\..\\src","sources":["index.tsx"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,qBAAqB","ignoreList":[]}
1
+ {"version":3,"names":["Platform","require","impl","OS","Error","module","exports","imapConnect","imapDisconnect","imapListMailboxes","imapSelectMailbox","imapRefreshMailbox","imapFetchFolders","imapCreateFolder","imapDeleteFolder","imapRenameFolder","imapSubscribeFolder","imapUnsubscribeFolder","imapFetchEmails","imapFetchEmailByUID","imapSearchEmails","imapMarkAsRead","imapMarkAsFlagged","imapMoveEmails","imapCopyEmails","imapDeleteEmails","imapExpunge","imapFetchAttachments","imapFetchAllAttachments","imapIdle","imapStopIdle","imapGetQuota","imapAppendMessage","smtpConnect","smtpDisconnect","smtpSendMail","smtpVerifyConnection","setProxyUrl","getProxyUrl","ImapNotConnectedError","SmtpNotConnectedError"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA4CA,MAAM;EAAEA;AAAS,CAAC,GAAGC,OAAO,CAAC,cAAc,CAAC;;AAE5C;;AAEA,IAAIC,IAAS;AAEb,IAAIF,QAAQ,CAACG,EAAE,KAAK,SAAS,EAAE;EAC7B;EACAD,IAAI,GAAGD,OAAO,CAAC,UAAU,CAAC;AAC5B,CAAC,MAAM,IAAID,QAAQ,CAACG,EAAE,KAAK,SAAS,EAAE;EACpC;EACAD,IAAI,GAAGD,OAAO,CAAC,WAAW,CAAC;AAC7B,CAAC,MAAM,IAAID,QAAQ,CAACG,EAAE,KAAK,KAAK,EAAE;EAChC,MAAM,IAAIC,KAAK,CACb,sDAAsD,GACpD,mDACJ,CAAC;AACH,CAAC,MAAM;EACL;EACAF,IAAI,GAAGD,OAAO,CAAC,OAAO,CAAC;AACzB;AAEAI,MAAM,CAACC,OAAO,GAAG;EACf;;EAEAC,WAAW,EAAEL,IAAI,CAACK,WAEgB;EAClCC,cAAc,EAAEN,IAAI,CAACM,cAAqC;EAC1DC,iBAAiB,EAAEP,IAAI,CAACO,iBAA6C;EACrEC,iBAAiB,EAAER,IAAI,CAACQ,iBAGG;E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AACA;AACA;EACEC,qBAAqB,EAAErC,IAAI,CAACqC,qBACG;EAE/B;AACF;AACA;AACA;EACEC,qBAAqB,EAAEtC,IAAI,CAACsC;AAE9B,CAAC;AAAC","ignoreList":[]}
@@ -1,45 +1,3 @@
1
1
  import type { IMAPConfig, SMTPConfig, IMAPConnectionResult, SMTPConnectionResult, Mailbox, MailboxStatus, Folder, Email, Attachment, FetchEmailsOptions, SearchCriteria, BatchResult, IMAPNotification, QuotaInfo, AppendResult, SendMailOptions, SendMailResult, EmailError } from './types.js';
2
2
  export type { IMAPConfig, SMTPConfig, IMAPConnectionResult, SMTPConnectionResult, Mailbox, MailboxStatus, Folder, Email, Attachment, FetchEmailsOptions, SearchCriteria, BatchResult, IMAPNotification, QuotaInfo, AppendResult, SendMailOptions, SendMailResult, EmailError, };
3
- export declare const imapConnect: (config: IMAPConfig) => Promise<IMAPConnectionResult>;
4
- export declare const imapDisconnect: () => Promise<void>;
5
- export declare const imapListMailboxes: () => Promise<Mailbox[]>;
6
- export declare const imapSelectMailbox: (mailbox: string, readOnly?: boolean) => Promise<MailboxStatus>;
7
- export declare const imapRefreshMailbox: () => Promise<MailboxStatus>;
8
- export declare const imapFetchFolders: () => Promise<Folder[]>;
9
- export declare const imapCreateFolder: (folderName: string) => Promise<void>;
10
- export declare const imapDeleteFolder: (folderName: string) => Promise<void>;
11
- export declare const imapRenameFolder: (oldName: string, newName: string) => Promise<void>;
12
- export declare const imapSubscribeFolder: (folderName: string) => Promise<void>;
13
- export declare const imapUnsubscribeFolder: (folderName: string) => Promise<void>;
14
- export declare const imapFetchEmails: (options: FetchEmailsOptions) => Promise<Email[]>;
15
- export declare const imapFetchEmailByUID: (uid: number) => Promise<Email | null>;
16
- export declare const imapSearchEmails: (criteria: SearchCriteria) => Promise<Email[]>;
17
- export declare const imapMarkAsRead: (uids: number[], silent?: boolean) => Promise<void>;
18
- export declare const imapMarkAsFlagged: (uids: number[], flagged: boolean) => Promise<void>;
19
- export declare const imapMoveEmails: (uids: number[], destinationMailbox: string) => Promise<void>;
20
- export declare const imapCopyEmails: (uids: number[], destinationMailbox: string) => Promise<void>;
21
- export declare const imapDeleteEmails: (uids: number[]) => Promise<BatchResult>;
22
- export declare const imapExpunge: () => Promise<void>;
23
- export declare const imapFetchAttachments: (uid: number, partId: string) => Promise<Attachment | null>;
24
- export declare const imapFetchAllAttachments: (uid: number) => Promise<Attachment[]>;
25
- export declare const imapIdle: (callback: (notification: IMAPNotification) => void) => Promise<void>;
26
- export declare const imapStopIdle: () => Promise<void>;
27
- export declare const imapGetQuota: (root?: string) => Promise<QuotaInfo>;
28
- export declare const imapAppendMessage: (mailbox: string, rawMimeData: ArrayBuffer, flags?: string[]) => Promise<AppendResult>;
29
- export declare const smtpConnect: (config: SMTPConfig) => Promise<SMTPConnectionResult>;
30
- export declare const smtpDisconnect: () => Promise<void>;
31
- export declare const smtpSendMail: (options: SendMailOptions) => Promise<SendMailResult>;
32
- export declare const smtpVerifyConnection: () => Promise<boolean>;
33
- export declare const setProxyUrl: ((url: string) => void) | undefined;
34
- export declare const getProxyUrl: (() => string) | undefined;
35
- /**
36
- * 连接错误类,可用于 `instanceof` 检查。
37
- * Web 平台始终可用,原生平台暂未实现。
38
- */
39
- export declare const ImapNotConnectedError: (new () => Error) | undefined;
40
- /**
41
- * SMTP 连接错误类,可用于 `instanceof` 检查。
42
- * Web 平台始终可用,原生平台暂未实现。
43
- */
44
- export declare const SmtpNotConnectedError: (new () => Error) | undefined;
45
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,oBAAoB,EACpB,oBAAoB,EACpB,OAAO,EACP,aAAa,EACb,MAAM,EACN,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,eAAe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,oBAAoB,EACpB,oBAAoB,EACpB,OAAO,EACP,aAAa,EACb,MAAM,EACN,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,eAAe,EACf,cAAc,EACd,UAAU,EACX,MAAM,YAAS,CAAC;AAEjB,YAAY,EACV,UAAU,EACV,UAAU,EACV,oBAAoB,EACpB,oBAAoB,EACpB,OAAO,EACP,aAAa,EACb,MAAM,EACN,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,eAAe,EACf,cAAc,EACd,UAAU,GACX,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-email-imap-smtp",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "The best of imap and smtp client of react native",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
package/server/proxy.mjs CHANGED
@@ -75,7 +75,7 @@ export async function startEmailProxy(options = {}) {
75
75
  cwd: serverDir,
76
76
  stdio: ['ignore', silent ? 'ignore' : 'inherit', 'pipe'],
77
77
  env: { ...process.env, PROXY_PORT: String(port) },
78
- shell: true,
78
+ shell: false,
79
79
  detached: detach,
80
80
  windowsHide: true,
81
81
  });
package/src/index.tsx CHANGED
@@ -7,7 +7,6 @@
7
7
  // Web / other → web.ts → throws not-supported
8
8
  // ============================================================
9
9
 
10
- import { Platform } from 'react-native';
11
10
  import type {
12
11
  IMAPConfig,
13
12
  SMTPConfig,
@@ -50,6 +49,8 @@ export type {
50
49
  EmailError,
51
50
  };
52
51
 
52
+ const { Platform } = require('react-native');
53
+
53
54
  // ─── Platform-aware module resolution ──────────────────────
54
55
 
55
56
  let impl: any;
@@ -70,117 +71,110 @@ if (Platform.OS === 'android') {
70
71
  impl = require('./web');
71
72
  }
72
73
 
73
- // ─── IMAP exports ───────────────────────────────────────────
74
+ module.exports = {
75
+ // ─── IMAP exports ───────────────────────────────────────────
74
76
 
75
- export const imapConnect = impl.imapConnect as (
76
- config: IMAPConfig
77
- ) => Promise<IMAPConnectionResult>;
78
- export const imapDisconnect = impl.imapDisconnect as () => Promise<void>;
79
- export const imapListMailboxes = impl.imapListMailboxes as () => Promise<
80
- Mailbox[]
81
- >;
82
- export const imapSelectMailbox = impl.imapSelectMailbox as (
83
- mailbox: string,
84
- readOnly?: boolean
85
- ) => Promise<MailboxStatus>;
86
- export const imapRefreshMailbox =
87
- impl.imapRefreshMailbox as () => Promise<MailboxStatus>;
88
- export const imapFetchFolders = impl.imapFetchFolders as () => Promise<
89
- Folder[]
90
- >;
91
- export const imapCreateFolder = impl.imapCreateFolder as (
92
- folderName: string
93
- ) => Promise<void>;
94
- export const imapDeleteFolder = impl.imapDeleteFolder as (
95
- folderName: string
96
- ) => Promise<void>;
97
- export const imapRenameFolder = impl.imapRenameFolder as (
98
- oldName: string,
99
- newName: string
100
- ) => Promise<void>;
101
- export const imapSubscribeFolder = impl.imapSubscribeFolder as (
102
- folderName: string
103
- ) => Promise<void>;
104
- export const imapUnsubscribeFolder = impl.imapUnsubscribeFolder as (
105
- folderName: string
106
- ) => Promise<void>;
107
- export const imapFetchEmails = impl.imapFetchEmails as (
108
- options: FetchEmailsOptions
109
- ) => Promise<Email[]>;
110
- export const imapFetchEmailByUID = impl.imapFetchEmailByUID as (
111
- uid: number
112
- ) => Promise<Email | null>;
113
- export const imapSearchEmails = impl.imapSearchEmails as (
114
- criteria: SearchCriteria
115
- ) => Promise<Email[]>;
116
- export const imapMarkAsRead = impl.imapMarkAsRead as (
117
- uids: number[],
118
- silent?: boolean
119
- ) => Promise<void>;
120
- export const imapMarkAsFlagged = impl.imapMarkAsFlagged as (
121
- uids: number[],
122
- flagged: boolean
123
- ) => Promise<void>;
124
- export const imapMoveEmails = impl.imapMoveEmails as (
125
- uids: number[],
126
- destinationMailbox: string
127
- ) => Promise<void>;
128
- export const imapCopyEmails = impl.imapCopyEmails as (
129
- uids: number[],
130
- destinationMailbox: string
131
- ) => Promise<void>;
132
- export const imapDeleteEmails = impl.imapDeleteEmails as (
133
- uids: number[]
134
- ) => Promise<BatchResult>;
135
- export const imapExpunge = impl.imapExpunge as () => Promise<void>;
136
- export const imapFetchAttachments = impl.imapFetchAttachments as (
137
- uid: number,
138
- partId: string
139
- ) => Promise<Attachment | null>;
140
- export const imapFetchAllAttachments = impl.imapFetchAllAttachments as (
141
- uid: number
142
- ) => Promise<Attachment[]>;
143
- export const imapIdle = impl.imapIdle as (
144
- callback: (notification: IMAPNotification) => void
145
- ) => Promise<void>;
146
- export const imapStopIdle = impl.imapStopIdle as () => Promise<void>;
147
- export const imapGetQuota = impl.imapGetQuota as (
148
- root?: string
149
- ) => Promise<QuotaInfo>;
150
- export const imapAppendMessage = impl.imapAppendMessage as (
151
- mailbox: string,
152
- rawMimeData: ArrayBuffer,
153
- flags?: string[]
154
- ) => Promise<AppendResult>;
77
+ imapConnect: impl.imapConnect as (
78
+ config: IMAPConfig
79
+ ) => Promise<IMAPConnectionResult>,
80
+ imapDisconnect: impl.imapDisconnect as () => Promise<void>,
81
+ imapListMailboxes: impl.imapListMailboxes as () => Promise<Mailbox[]>,
82
+ imapSelectMailbox: impl.imapSelectMailbox as (
83
+ mailbox: string,
84
+ readOnly?: boolean
85
+ ) => Promise<MailboxStatus>,
86
+ imapRefreshMailbox: impl.imapRefreshMailbox as () => Promise<MailboxStatus>,
87
+ imapFetchFolders: impl.imapFetchFolders as () => Promise<Folder[]>,
88
+ imapCreateFolder: impl.imapCreateFolder as (
89
+ folderName: string
90
+ ) => Promise<void>,
91
+ imapDeleteFolder: impl.imapDeleteFolder as (
92
+ folderName: string
93
+ ) => Promise<void>,
94
+ imapRenameFolder: impl.imapRenameFolder as (
95
+ oldName: string,
96
+ newName: string
97
+ ) => Promise<void>,
98
+ imapSubscribeFolder: impl.imapSubscribeFolder as (
99
+ folderName: string
100
+ ) => Promise<void>,
101
+ imapUnsubscribeFolder: impl.imapUnsubscribeFolder as (
102
+ folderName: string
103
+ ) => Promise<void>,
104
+ imapFetchEmails: impl.imapFetchEmails as (
105
+ options: FetchEmailsOptions
106
+ ) => Promise<Email[]>,
107
+ imapFetchEmailByUID: impl.imapFetchEmailByUID as (
108
+ uid: number
109
+ ) => Promise<Email | null>,
110
+ imapSearchEmails: impl.imapSearchEmails as (
111
+ criteria: SearchCriteria
112
+ ) => Promise<Email[]>,
113
+ imapMarkAsRead: impl.imapMarkAsRead as (
114
+ uids: number[],
115
+ silent?: boolean
116
+ ) => Promise<void>,
117
+ imapMarkAsFlagged: impl.imapMarkAsFlagged as (
118
+ uids: number[],
119
+ flagged: boolean
120
+ ) => Promise<void>,
121
+ imapMoveEmails: impl.imapMoveEmails as (
122
+ uids: number[],
123
+ destinationMailbox: string
124
+ ) => Promise<void>,
125
+ imapCopyEmails: impl.imapCopyEmails as (
126
+ uids: number[],
127
+ destinationMailbox: string
128
+ ) => Promise<void>,
129
+ imapDeleteEmails: impl.imapDeleteEmails as (
130
+ uids: number[]
131
+ ) => Promise<BatchResult>,
132
+ imapExpunge: impl.imapExpunge as () => Promise<void>,
133
+ imapFetchAttachments: impl.imapFetchAttachments as (
134
+ uid: number,
135
+ partId: string
136
+ ) => Promise<Attachment | null>,
137
+ imapFetchAllAttachments: impl.imapFetchAllAttachments as (
138
+ uid: number
139
+ ) => Promise<Attachment[]>,
140
+ imapIdle: impl.imapIdle as (
141
+ callback: (notification: IMAPNotification) => void
142
+ ) => Promise<void>,
143
+ imapStopIdle: impl.imapStopIdle as () => Promise<void>,
144
+ imapGetQuota: impl.imapGetQuota as (root?: string) => Promise<QuotaInfo>,
145
+ imapAppendMessage: impl.imapAppendMessage as (
146
+ mailbox: string,
147
+ rawMimeData: ArrayBuffer,
148
+ flags?: string[]
149
+ ) => Promise<AppendResult>,
155
150
 
156
- // ─── SMTP exports ──────────────────────────────────────────
151
+ // ─── SMTP exports ──────────────────────────────────────────
157
152
 
158
- export const smtpConnect = impl.smtpConnect as (
159
- config: SMTPConfig
160
- ) => Promise<SMTPConnectionResult>;
161
- export const smtpDisconnect = impl.smtpDisconnect as () => Promise<void>;
162
- export const smtpSendMail = impl.smtpSendMail as (
163
- options: SendMailOptions
164
- ) => Promise<SendMailResult>;
165
- export const smtpVerifyConnection =
166
- impl.smtpVerifyConnection as () => Promise<boolean>;
153
+ smtpConnect: impl.smtpConnect as (
154
+ config: SMTPConfig
155
+ ) => Promise<SMTPConnectionResult>,
156
+ smtpDisconnect: impl.smtpDisconnect as () => Promise<void>,
157
+ smtpSendMail: impl.smtpSendMail as (
158
+ options: SendMailOptions
159
+ ) => Promise<SendMailResult>,
160
+ smtpVerifyConnection: impl.smtpVerifyConnection as () => Promise<boolean>,
167
161
 
168
- // ─── Web 专属导出(原生平台为 undefined) ─────────────────
162
+ // ─── Web 专属导出(原生平台为 undefined) ─────────────────
169
163
 
170
- export const setProxyUrl: ((url: string) => void) | undefined =
171
- impl.setProxyUrl;
172
- export const getProxyUrl: (() => string) | undefined = impl.getProxyUrl;
164
+ setProxyUrl: impl.setProxyUrl as ((url: string) => void) | undefined,
165
+ getProxyUrl: impl.getProxyUrl as (() => string) | undefined,
173
166
 
174
- /**
175
- * 连接错误类,可用于 `instanceof` 检查。
176
- * Web 平台始终可用,原生平台暂未实现。
177
- */
178
- export const ImapNotConnectedError: (new () => Error) | undefined =
179
- impl.ImapNotConnectedError;
167
+ /**
168
+ * 连接错误类,可用于 `instanceof` 检查。
169
+ * Web 平台始终可用,原生平台暂未实现。
170
+ */
171
+ ImapNotConnectedError: impl.ImapNotConnectedError as
172
+ (new () => Error) | undefined,
180
173
 
181
- /**
182
- * SMTP 连接错误类,可用于 `instanceof` 检查。
183
- * Web 平台始终可用,原生平台暂未实现。
184
- */
185
- export const SmtpNotConnectedError: (new () => Error) | undefined =
186
- impl.SmtpNotConnectedError;
174
+ /**
175
+ * SMTP 连接错误类,可用于 `instanceof` 检查。
176
+ * Web 平台始终可用,原生平台暂未实现。
177
+ */
178
+ SmtpNotConnectedError: impl.SmtpNotConnectedError as
179
+ (new () => Error) | undefined,
180
+ };