react-native-email-imap-smtp 0.1.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/EmailImapSmtp.podspec +29 -0
- package/LICENSE +20 -0
- package/README.md +121 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +117 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/cpp/cpp-adapter.cpp +11 -0
- package/android/src/main/java/com/margelo/nitro/emailimapsmtp/EmailImapSmtp.kt +1533 -0
- package/android/src/main/java/com/margelo/nitro/emailimapsmtp/EmailImapSmtpPackage.kt +22 -0
- package/ios/EmailImapSmtp.swift +5 -0
- package/lib/module/EmailImapSmtp.nitro.js +4 -0
- package/lib/module/EmailImapSmtp.nitro.js.map +1 -0
- package/lib/module/NativeEmailImapSmtp.js +14 -0
- package/lib/module/NativeEmailImapSmtp.js.map +1 -0
- package/lib/module/index.js +64 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/native.js +227 -0
- package/lib/module/native.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/web.js +107 -0
- package/lib/module/web.js.map +1 -0
- package/lib/module/windows.js +156 -0
- package/lib/module/windows.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/EmailImapSmtp.nitro.d.ts +268 -0
- package/lib/typescript/src/EmailImapSmtp.nitro.d.ts.map +1 -0
- package/lib/typescript/src/NativeEmailImapSmtp.d.ts +36 -0
- package/lib/typescript/src/NativeEmailImapSmtp.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +33 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/native.d.ts +32 -0
- package/lib/typescript/src/native.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +261 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/web.d.ts +32 -0
- package/lib/typescript/src/web.d.ts.map +1 -0
- package/lib/typescript/src/windows.d.ts +32 -0
- package/lib/typescript/src/windows.d.ts.map +1 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/android/c++/JAppendResult.hpp +65 -0
- package/nitrogen/generated/android/c++/JAttachmentInfo.hpp +96 -0
- package/nitrogen/generated/android/c++/JConnectionConfig.hpp +94 -0
- package/nitrogen/generated/android/c++/JConnectionResult.hpp +73 -0
- package/nitrogen/generated/android/c++/JDeleteResult.hpp +87 -0
- package/nitrogen/generated/android/c++/JEmailAddress.hpp +61 -0
- package/nitrogen/generated/android/c++/JEmailBody.hpp +84 -0
- package/nitrogen/generated/android/c++/JEmailMessage.hpp +273 -0
- package/nitrogen/generated/android/c++/JFetchEmailsOptions.hpp +110 -0
- package/nitrogen/generated/android/c++/JFolderInfo.hpp +126 -0
- package/nitrogen/generated/android/c++/JFunc_void_IdleNotification.hpp +79 -0
- package/nitrogen/generated/android/c++/JHybridEmailImapSmtpSpec.cpp +697 -0
- package/nitrogen/generated/android/c++/JHybridEmailImapSmtpSpec.hpp +92 -0
- package/nitrogen/generated/android/c++/JIdleNotification.hpp +78 -0
- package/nitrogen/generated/android/c++/JImapServerInfo.hpp +84 -0
- package/nitrogen/generated/android/c++/JMailboxInfo.hpp +134 -0
- package/nitrogen/generated/android/c++/JMailboxListItem.hpp +92 -0
- package/nitrogen/generated/android/c++/JQuotaInfo.hpp +78 -0
- package/nitrogen/generated/android/c++/JSearchCriteria.hpp +187 -0
- package/nitrogen/generated/android/c++/JSearchHeader.hpp +61 -0
- package/nitrogen/generated/android/c++/JSendMailOptions.hpp +229 -0
- package/nitrogen/generated/android/c++/JSendMailResult.hpp +88 -0
- package/nitrogen/generated/android/c++/JSmtpAttachment.hpp +80 -0
- package/nitrogen/generated/android/c++/JSmtpConnectionConfig.hpp +98 -0
- package/nitrogen/generated/android/c++/JSmtpServerInfo.hpp +102 -0
- package/nitrogen/generated/android/c++/JVariant_ImapServerInfo_SmtpServerInfo.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_ImapServerInfo_SmtpServerInfo.hpp +73 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_AttachmentInfo.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_AttachmentInfo.hpp +75 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_EmailMessage.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_EmailMessage.hpp +83 -0
- package/nitrogen/generated/android/emailimapsmtp+autolinking.cmake +84 -0
- package/nitrogen/generated/android/emailimapsmtp+autolinking.gradle +27 -0
- package/nitrogen/generated/android/emailimapsmtpOnLoad.cpp +56 -0
- package/nitrogen/generated/android/emailimapsmtpOnLoad.hpp +34 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/AppendResult.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/AttachmentInfo.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/ConnectionConfig.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/ConnectionResult.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/DeleteResult.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/EmailAddress.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/EmailBody.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/EmailMessage.kt +156 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/FetchEmailsOptions.kt +116 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/FolderInfo.kt +91 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/Func_void_IdleNotification.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/HybridEmailImapSmtpSpec.kt +178 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/IdleNotification.kt +76 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/ImapServerInfo.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/MailboxInfo.kt +101 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/MailboxListItem.kt +71 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/QuotaInfo.kt +76 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/SearchCriteria.kt +196 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/SearchHeader.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/SendMailOptions.kt +126 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/SendMailResult.kt +86 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/SmtpAttachment.kt +76 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/SmtpConnectionConfig.kt +101 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/SmtpServerInfo.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/Variant_ImapServerInfo_SmtpServerInfo.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/Variant_NullType_AttachmentInfo.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/Variant_NullType_EmailMessage.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/emailimapsmtpOnLoad.kt +35 -0
- package/nitrogen/generated/ios/EmailImapSmtp+autolinking.rb +62 -0
- package/nitrogen/generated/ios/EmailImapSmtp-Swift-Cxx-Bridge.cpp +161 -0
- package/nitrogen/generated/ios/EmailImapSmtp-Swift-Cxx-Bridge.hpp +1132 -0
- package/nitrogen/generated/ios/EmailImapSmtp-Swift-Cxx-Umbrella.hpp +118 -0
- package/nitrogen/generated/ios/EmailImapSmtpAutolinking.mm +33 -0
- package/nitrogen/generated/ios/EmailImapSmtpAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridEmailImapSmtpSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridEmailImapSmtpSpecSwift.hpp +390 -0
- package/nitrogen/generated/ios/swift/AppendResult.swift +39 -0
- package/nitrogen/generated/ios/swift/AttachmentInfo.swift +113 -0
- package/nitrogen/generated/ios/swift/ConnectionConfig.swift +87 -0
- package/nitrogen/generated/ios/swift/ConnectionResult.swift +84 -0
- package/nitrogen/generated/ios/swift/DeleteResult.swift +64 -0
- package/nitrogen/generated/ios/swift/EmailAddress.swift +34 -0
- package/nitrogen/generated/ios/swift/EmailBody.swift +45 -0
- package/nitrogen/generated/ios/swift/EmailMessage.swift +184 -0
- package/nitrogen/generated/ios/swift/FetchEmailsOptions.swift +198 -0
- package/nitrogen/generated/ios/swift/FolderInfo.swift +81 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_AppendResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_ConnectionResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_DeleteResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_IdleNotification.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_MailboxInfo.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_QuotaInfo.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_SendMailResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_nitro__NullType__AttachmentInfo_.swift +58 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_nitro__NullType__EmailMessage_.swift +58 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_AttachmentInfo_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_EmailMessage_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_FolderInfo_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_MailboxListItem_.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridEmailImapSmtpSpec.swift +84 -0
- package/nitrogen/generated/ios/swift/HybridEmailImapSmtpSpec_cxx.swift +759 -0
- package/nitrogen/generated/ios/swift/IdleNotification.swift +93 -0
- package/nitrogen/generated/ios/swift/ImapServerInfo.swift +45 -0
- package/nitrogen/generated/ios/swift/MailboxInfo.swift +91 -0
- package/nitrogen/generated/ios/swift/MailboxListItem.swift +55 -0
- package/nitrogen/generated/ios/swift/QuotaInfo.swift +80 -0
- package/nitrogen/generated/ios/swift/SearchCriteria.swift +485 -0
- package/nitrogen/generated/ios/swift/SearchHeader.swift +34 -0
- package/nitrogen/generated/ios/swift/SendMailOptions.swift +310 -0
- package/nitrogen/generated/ios/swift/SendMailResult.swift +155 -0
- package/nitrogen/generated/ios/swift/SmtpAttachment.swift +80 -0
- package/nitrogen/generated/ios/swift/SmtpConnectionConfig.swift +105 -0
- package/nitrogen/generated/ios/swift/SmtpServerInfo.swift +51 -0
- package/nitrogen/generated/ios/swift/Variant_ImapServerInfo_SmtpServerInfo.swift +30 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_AttachmentInfo.swift +30 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_EmailMessage.swift +30 -0
- package/nitrogen/generated/shared/c++/AppendResult.hpp +91 -0
- package/nitrogen/generated/shared/c++/AttachmentInfo.hpp +121 -0
- package/nitrogen/generated/shared/c++/ConnectionConfig.hpp +120 -0
- package/nitrogen/generated/shared/c++/ConnectionResult.hpp +98 -0
- package/nitrogen/generated/shared/c++/DeleteResult.hpp +93 -0
- package/nitrogen/generated/shared/c++/EmailAddress.hpp +87 -0
- package/nitrogen/generated/shared/c++/EmailBody.hpp +92 -0
- package/nitrogen/generated/shared/c++/EmailMessage.hpp +177 -0
- package/nitrogen/generated/shared/c++/FetchEmailsOptions.hpp +136 -0
- package/nitrogen/generated/shared/c++/FolderInfo.hpp +116 -0
- package/nitrogen/generated/shared/c++/HybridEmailImapSmtpSpec.cpp +50 -0
- package/nitrogen/generated/shared/c++/HybridEmailImapSmtpSpec.hpp +145 -0
- package/nitrogen/generated/shared/c++/IdleNotification.hpp +104 -0
- package/nitrogen/generated/shared/c++/ImapServerInfo.hpp +92 -0
- package/nitrogen/generated/shared/c++/MailboxInfo.hpp +124 -0
- package/nitrogen/generated/shared/c++/MailboxListItem.hpp +100 -0
- package/nitrogen/generated/shared/c++/QuotaInfo.hpp +104 -0
- package/nitrogen/generated/shared/c++/SearchCriteria.hpp +203 -0
- package/nitrogen/generated/shared/c++/SearchHeader.hpp +87 -0
- package/nitrogen/generated/shared/c++/SendMailOptions.hpp +151 -0
- package/nitrogen/generated/shared/c++/SendMailResult.hpp +113 -0
- package/nitrogen/generated/shared/c++/SmtpAttachment.hpp +105 -0
- package/nitrogen/generated/shared/c++/SmtpConnectionConfig.hpp +124 -0
- package/nitrogen/generated/shared/c++/SmtpServerInfo.hpp +92 -0
- package/package.json +196 -0
- package/react-native.config.js +27 -0
- package/src/EmailImapSmtp.nitro.ts +333 -0
- package/src/NativeEmailImapSmtp.ts +100 -0
- package/src/index.tsx +166 -0
- package/src/native.ts +305 -0
- package/src/types.ts +328 -0
- package/src/web.ts +196 -0
- package/src/windows.ts +304 -0
- package/windows/EmailImapSmtp.cpp +735 -0
- package/windows/EmailImapSmtp.h +137 -0
- package/windows/EmailImapSmtpModule.cpp +10 -0
- package/windows/EmailImapSmtpModule.h +139 -0
- package/windows/EmailImapSmtpPackage.cpp +15 -0
- package/windows/EmailImapSmtpPackage.h +13 -0
- package/windows/ImapProtocol.cpp +1382 -0
- package/windows/ImapProtocol.h +97 -0
- package/windows/ProtocolDefs.h +300 -0
- package/windows/SmtpProtocol.cpp +334 -0
- package/windows/SmtpProtocol.h +36 -0
- package/windows/TlsSocket.cpp +818 -0
- package/windows/TlsSocket.h +87 -0
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// EmailImapSmtp — Nitro HybridObject Interface
|
|
3
|
+
// iOS -> Swift | Android -> Kotlin
|
|
4
|
+
// ============================================================
|
|
5
|
+
|
|
6
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
7
|
+
|
|
8
|
+
// ─── Shared Types ─────────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
export interface EmailAddress {
|
|
11
|
+
name: string;
|
|
12
|
+
email: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ConnectionConfig {
|
|
16
|
+
host: string;
|
|
17
|
+
port: number;
|
|
18
|
+
username: string;
|
|
19
|
+
password: string;
|
|
20
|
+
tls: boolean;
|
|
21
|
+
authType: string;
|
|
22
|
+
accessToken?: string;
|
|
23
|
+
timeout: number;
|
|
24
|
+
checkCertificate: boolean;
|
|
25
|
+
debug: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface SmtpConnectionConfig {
|
|
29
|
+
host: string;
|
|
30
|
+
port: number;
|
|
31
|
+
username: string;
|
|
32
|
+
password: string;
|
|
33
|
+
tls: boolean;
|
|
34
|
+
authType: string;
|
|
35
|
+
accessToken?: string;
|
|
36
|
+
timeout: number;
|
|
37
|
+
checkCertificate: boolean;
|
|
38
|
+
helloName?: string;
|
|
39
|
+
debug: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ImapServerInfo {
|
|
43
|
+
serverName: string;
|
|
44
|
+
capabilities: string[];
|
|
45
|
+
isCompressed: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface SmtpServerInfo {
|
|
49
|
+
serverName: string;
|
|
50
|
+
capabilities: string[];
|
|
51
|
+
supportedAuthMethods: string[];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface ConnectionResult {
|
|
55
|
+
success: boolean;
|
|
56
|
+
serverInfo?: ImapServerInfo | SmtpServerInfo;
|
|
57
|
+
error?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface MailboxListItem {
|
|
61
|
+
name: string;
|
|
62
|
+
path: string;
|
|
63
|
+
delimiter: string;
|
|
64
|
+
flags: string[];
|
|
65
|
+
subscribed: boolean;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface MailboxInfo {
|
|
69
|
+
name: string;
|
|
70
|
+
path: string;
|
|
71
|
+
uidNext: number;
|
|
72
|
+
uidValidity: number;
|
|
73
|
+
messageCount: number;
|
|
74
|
+
recentCount: number;
|
|
75
|
+
unseenCount: number;
|
|
76
|
+
firstUnseenUid: number;
|
|
77
|
+
highestModSeq: number;
|
|
78
|
+
flags: string[];
|
|
79
|
+
permanentFlags: string[];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface FolderInfo {
|
|
83
|
+
name: string;
|
|
84
|
+
path: string;
|
|
85
|
+
delimiter: string;
|
|
86
|
+
parent: string;
|
|
87
|
+
children: string[];
|
|
88
|
+
flags: string[];
|
|
89
|
+
subscribed: boolean;
|
|
90
|
+
messageCount: number;
|
|
91
|
+
unseenCount: number;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface EmailBody {
|
|
95
|
+
text: string;
|
|
96
|
+
html: string;
|
|
97
|
+
embeddedAttachments: string[];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface EmailMessage {
|
|
101
|
+
uid: number;
|
|
102
|
+
sequenceNumber: number;
|
|
103
|
+
subject: string;
|
|
104
|
+
from: EmailAddress;
|
|
105
|
+
to: EmailAddress[];
|
|
106
|
+
cc: EmailAddress[];
|
|
107
|
+
bcc: EmailAddress[];
|
|
108
|
+
replyTo: EmailAddress[];
|
|
109
|
+
date: string;
|
|
110
|
+
receivedDate: string;
|
|
111
|
+
body: EmailBody;
|
|
112
|
+
attachments: AttachmentInfo[];
|
|
113
|
+
flags: string[];
|
|
114
|
+
headers: Record<string, string>;
|
|
115
|
+
size: number;
|
|
116
|
+
messageId: string;
|
|
117
|
+
inReplyTo: string;
|
|
118
|
+
references: string;
|
|
119
|
+
priority: string;
|
|
120
|
+
isEncrypted: boolean;
|
|
121
|
+
mimeType: string;
|
|
122
|
+
charset: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface FetchEmailsOptions {
|
|
126
|
+
from?: number;
|
|
127
|
+
to?: number;
|
|
128
|
+
rangeType?: string;
|
|
129
|
+
page?: number;
|
|
130
|
+
pageSize?: number;
|
|
131
|
+
since?: string;
|
|
132
|
+
before?: string;
|
|
133
|
+
mailbox?: string;
|
|
134
|
+
fetchBody: boolean;
|
|
135
|
+
fetchAttachments: boolean;
|
|
136
|
+
fetchFlags: boolean;
|
|
137
|
+
fetchHeaders: boolean;
|
|
138
|
+
fetchFullContent: boolean;
|
|
139
|
+
maxBodySize: number;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface SearchHeader {
|
|
143
|
+
key: string;
|
|
144
|
+
value: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface SearchCriteria {
|
|
148
|
+
text?: string;
|
|
149
|
+
subject?: string;
|
|
150
|
+
from?: string;
|
|
151
|
+
to?: string;
|
|
152
|
+
body?: string;
|
|
153
|
+
since?: string;
|
|
154
|
+
before?: string;
|
|
155
|
+
on?: string;
|
|
156
|
+
sentSince?: string;
|
|
157
|
+
sentBefore?: string;
|
|
158
|
+
flagged?: boolean;
|
|
159
|
+
seen?: boolean;
|
|
160
|
+
answered?: boolean;
|
|
161
|
+
draft?: boolean;
|
|
162
|
+
deleted?: boolean;
|
|
163
|
+
junk?: boolean;
|
|
164
|
+
hasAttachment?: boolean;
|
|
165
|
+
uids?: number[];
|
|
166
|
+
header?: SearchHeader;
|
|
167
|
+
larger?: number;
|
|
168
|
+
smaller?: number;
|
|
169
|
+
mailbox?: string;
|
|
170
|
+
sortOrder?: string;
|
|
171
|
+
limit?: number;
|
|
172
|
+
fetchBody: boolean;
|
|
173
|
+
fetchAttachments: boolean;
|
|
174
|
+
fetchFlags: boolean;
|
|
175
|
+
fetchHeaders: boolean;
|
|
176
|
+
fetchFullContent: boolean;
|
|
177
|
+
maxBodySize: number;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface DeleteResult {
|
|
181
|
+
success: number[];
|
|
182
|
+
failed: number[];
|
|
183
|
+
error?: string;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface AttachmentInfo {
|
|
187
|
+
filename: string;
|
|
188
|
+
mimeType: string;
|
|
189
|
+
partId: string;
|
|
190
|
+
size: number;
|
|
191
|
+
data: ArrayBuffer;
|
|
192
|
+
contentId?: string;
|
|
193
|
+
inline: boolean;
|
|
194
|
+
charset?: string;
|
|
195
|
+
contentDisposition: string;
|
|
196
|
+
/** 附件缓存在本地的文件路径(如果有),避免大附件全部加载到内存 */
|
|
197
|
+
localPath?: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface IdleNotification {
|
|
201
|
+
type: string;
|
|
202
|
+
mailbox: string;
|
|
203
|
+
uid?: number;
|
|
204
|
+
flag?: string;
|
|
205
|
+
messageCount?: number;
|
|
206
|
+
timestamp: number;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export interface QuotaInfo {
|
|
210
|
+
storageUsed: number;
|
|
211
|
+
storageLimit: number;
|
|
212
|
+
storageUnit: string;
|
|
213
|
+
messagesUsed?: number;
|
|
214
|
+
messagesLimit?: number;
|
|
215
|
+
root: string;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export interface AppendResult {
|
|
219
|
+
uid: number;
|
|
220
|
+
uidValidity: number;
|
|
221
|
+
date: string;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export interface SmtpAttachment {
|
|
225
|
+
filename: string;
|
|
226
|
+
mimeType: string;
|
|
227
|
+
data: ArrayBuffer;
|
|
228
|
+
inline: boolean;
|
|
229
|
+
contentId?: string;
|
|
230
|
+
disposition?: string;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface SendMailOptions {
|
|
234
|
+
from: EmailAddress;
|
|
235
|
+
to: EmailAddress[];
|
|
236
|
+
cc?: EmailAddress[];
|
|
237
|
+
bcc?: EmailAddress[];
|
|
238
|
+
replyTo?: EmailAddress[];
|
|
239
|
+
subject: string;
|
|
240
|
+
textBody?: string;
|
|
241
|
+
htmlBody?: string;
|
|
242
|
+
attachments?: SmtpAttachment[];
|
|
243
|
+
priority?: string;
|
|
244
|
+
headers?: Record<string, string>;
|
|
245
|
+
inReplyTo?: string;
|
|
246
|
+
references?: string;
|
|
247
|
+
readReceiptTo?: EmailAddress;
|
|
248
|
+
charset?: string;
|
|
249
|
+
encoding?: string;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface SendMailResult {
|
|
253
|
+
success: boolean;
|
|
254
|
+
messageId?: string;
|
|
255
|
+
date?: string;
|
|
256
|
+
serverResponseCode?: number;
|
|
257
|
+
rawMimeData?: ArrayBuffer;
|
|
258
|
+
queueId?: string;
|
|
259
|
+
error?: string;
|
|
260
|
+
retryable?: boolean;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// ═══════════════════════════════════════════════════════════
|
|
264
|
+
// HybridObject Interface
|
|
265
|
+
// ═══════════════════════════════════════════════════════════
|
|
266
|
+
|
|
267
|
+
export interface EmailImapSmtp extends HybridObject<{
|
|
268
|
+
ios: 'swift';
|
|
269
|
+
android: 'kotlin';
|
|
270
|
+
}> {
|
|
271
|
+
// ─── Connection ─────────────────────────────────────────
|
|
272
|
+
imapConnect(config: ConnectionConfig): Promise<ConnectionResult>;
|
|
273
|
+
imapDisconnect(): Promise<void>;
|
|
274
|
+
|
|
275
|
+
// ─── Mailbox ────────────────────────────────────────────
|
|
276
|
+
imapListMailboxes(): Promise<MailboxListItem[]>;
|
|
277
|
+
imapSelectMailbox(mailbox: string, readOnly: boolean): Promise<MailboxInfo>;
|
|
278
|
+
imapRefreshMailbox(): Promise<MailboxInfo>;
|
|
279
|
+
|
|
280
|
+
// ─── Folders ────────────────────────────────────────────
|
|
281
|
+
imapFetchFolders(): Promise<FolderInfo[]>;
|
|
282
|
+
imapCreateFolder(folderName: string): Promise<void>;
|
|
283
|
+
imapDeleteFolder(folderName: string): Promise<void>;
|
|
284
|
+
imapRenameFolder(oldName: string, newName: string): Promise<void>;
|
|
285
|
+
imapSubscribeFolder(folderName: string): Promise<void>;
|
|
286
|
+
imapUnsubscribeFolder(folderName: string): Promise<void>;
|
|
287
|
+
|
|
288
|
+
// ─── Fetch Emails ────────────────────────────────────────
|
|
289
|
+
imapFetchEmails(options: FetchEmailsOptions): Promise<EmailMessage[]>;
|
|
290
|
+
imapFetchEmailByUID(uid: number): Promise<EmailMessage | null>;
|
|
291
|
+
|
|
292
|
+
// ─── Search ─────────────────────────────────────────────
|
|
293
|
+
imapSearchEmails(criteria: SearchCriteria): Promise<EmailMessage[]>;
|
|
294
|
+
|
|
295
|
+
// ─── Flags ──────────────────────────────────────────────
|
|
296
|
+
imapMarkAsRead(uids: number[], silent: boolean): Promise<void>;
|
|
297
|
+
imapMarkAsFlagged(uids: number[], flagged: boolean): Promise<void>;
|
|
298
|
+
|
|
299
|
+
// ─── Move / Copy / Delete ───────────────────────────────
|
|
300
|
+
imapMoveEmails(uids: number[], destinationMailbox: string): Promise<void>;
|
|
301
|
+
imapCopyEmails(uids: number[], destinationMailbox: string): Promise<void>;
|
|
302
|
+
imapDeleteEmails(uids: number[]): Promise<DeleteResult>;
|
|
303
|
+
imapExpunge(): Promise<void>;
|
|
304
|
+
|
|
305
|
+
// ─── Attachments ───────────────────────────────────────
|
|
306
|
+
imapFetchAttachments(
|
|
307
|
+
uid: number,
|
|
308
|
+
partId: string
|
|
309
|
+
): Promise<AttachmentInfo | null>;
|
|
310
|
+
imapFetchAllAttachments(uid: number): Promise<AttachmentInfo[]>;
|
|
311
|
+
|
|
312
|
+
// ─── IDLE ──────────────────────────────────────────────
|
|
313
|
+
imapIdle(callback: (notification: IdleNotification) => void): Promise<void>;
|
|
314
|
+
imapStopIdle(): Promise<void>;
|
|
315
|
+
|
|
316
|
+
// ─── Quota ──────────────────────────────────────────────
|
|
317
|
+
imapGetQuota(root?: string): Promise<QuotaInfo>;
|
|
318
|
+
|
|
319
|
+
// ─── Append ────────────────────────────────────────────
|
|
320
|
+
imapAppendMessage(
|
|
321
|
+
mailbox: string,
|
|
322
|
+
rawMimeData: ArrayBuffer,
|
|
323
|
+
flags?: string[]
|
|
324
|
+
): Promise<AppendResult>;
|
|
325
|
+
|
|
326
|
+
// ═══════════════════════════════════════════════════════
|
|
327
|
+
// SMTP
|
|
328
|
+
// ═══════════════════════════════════════════════════════
|
|
329
|
+
smtpConnect(config: SmtpConnectionConfig): Promise<ConnectionResult>;
|
|
330
|
+
smtpDisconnect(): Promise<void>;
|
|
331
|
+
smtpSendMail(options: SendMailOptions): Promise<SendMailResult>;
|
|
332
|
+
smtpVerifyConnection(): Promise<boolean>;
|
|
333
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// NativeEmailImapSmtp.ts — Windows TurboModule 接口定义
|
|
3
|
+
// Android 继续使用 Nitro (src/native.ts)
|
|
4
|
+
// ============================================================
|
|
5
|
+
// react-native-windows 的 autolinking 会识别此文件并生成
|
|
6
|
+
// 对应的 C++/WinRT 桥接代码 (.g.h / .g.cpp)
|
|
7
|
+
// ============================================================
|
|
8
|
+
|
|
9
|
+
import type { TurboModule } from 'react-native';
|
|
10
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
11
|
+
|
|
12
|
+
export interface Spec extends TurboModule {
|
|
13
|
+
// ─── IMAP 连接 ─────────────────────────────────────────
|
|
14
|
+
imapConnect(configJson: string): Promise<string>;
|
|
15
|
+
imapDisconnect(sessionId: string): Promise<void>;
|
|
16
|
+
|
|
17
|
+
// ─── 邮箱操作 ──────────────────────────────────────────
|
|
18
|
+
imapListMailboxes(sessionId: string): Promise<string>;
|
|
19
|
+
imapSelectMailbox(
|
|
20
|
+
sessionId: string,
|
|
21
|
+
mailbox: string,
|
|
22
|
+
readOnly: boolean
|
|
23
|
+
): Promise<string>;
|
|
24
|
+
imapRefreshMailbox(sessionId: string): Promise<string>;
|
|
25
|
+
|
|
26
|
+
// ─── 文件夹操作 ────────────────────────────────────────
|
|
27
|
+
imapFetchFolders(sessionId: string): Promise<string>;
|
|
28
|
+
imapCreateFolder(sessionId: string, folderName: string): Promise<void>;
|
|
29
|
+
imapDeleteFolder(sessionId: string, folderName: string): Promise<void>;
|
|
30
|
+
imapRenameFolder(
|
|
31
|
+
sessionId: string,
|
|
32
|
+
oldName: string,
|
|
33
|
+
newName: string
|
|
34
|
+
): Promise<void>;
|
|
35
|
+
imapSubscribeFolder(sessionId: string, folderName: string): Promise<void>;
|
|
36
|
+
imapUnsubscribeFolder(sessionId: string, folderName: string): Promise<void>;
|
|
37
|
+
|
|
38
|
+
// ─── 获取邮件 ──────────────────────────────────────────
|
|
39
|
+
imapFetchEmails(sessionId: string, optionsJson: string): Promise<string>;
|
|
40
|
+
imapFetchEmailByUID(sessionId: string, uid: number): Promise<string>;
|
|
41
|
+
|
|
42
|
+
// ─── 搜索 ──────────────────────────────────────────────
|
|
43
|
+
imapSearchEmails(sessionId: string, criteriaJson: string): Promise<string>;
|
|
44
|
+
|
|
45
|
+
// ─── 标记 ──────────────────────────────────────────────
|
|
46
|
+
imapMarkAsRead(
|
|
47
|
+
sessionId: string,
|
|
48
|
+
uidsJson: string,
|
|
49
|
+
silent: boolean
|
|
50
|
+
): Promise<void>;
|
|
51
|
+
imapMarkAsFlagged(
|
|
52
|
+
sessionId: string,
|
|
53
|
+
uidsJson: string,
|
|
54
|
+
flagged: boolean
|
|
55
|
+
): Promise<void>;
|
|
56
|
+
|
|
57
|
+
// ─── 移动/复制/删除 ────────────────────────────────────
|
|
58
|
+
imapMoveEmails(
|
|
59
|
+
sessionId: string,
|
|
60
|
+
uidsJson: string,
|
|
61
|
+
destinationMailbox: string
|
|
62
|
+
): Promise<void>;
|
|
63
|
+
imapCopyEmails(
|
|
64
|
+
sessionId: string,
|
|
65
|
+
uidsJson: string,
|
|
66
|
+
destinationMailbox: string
|
|
67
|
+
): Promise<void>;
|
|
68
|
+
imapDeleteEmails(sessionId: string, uidsJson: string): Promise<string>;
|
|
69
|
+
imapExpunge(sessionId: string): Promise<void>;
|
|
70
|
+
|
|
71
|
+
// ─── 附件 ──────────────────────────────────────────────
|
|
72
|
+
imapFetchAttachment(
|
|
73
|
+
sessionId: string,
|
|
74
|
+
uid: number,
|
|
75
|
+
partId: string
|
|
76
|
+
): Promise<string>;
|
|
77
|
+
imapFetchAllAttachments(sessionId: string, uid: number): Promise<string>;
|
|
78
|
+
|
|
79
|
+
// ─── IDLE ──────────────────────────────────────────────
|
|
80
|
+
imapIdle(sessionId: string): Promise<void>;
|
|
81
|
+
imapStopIdle(sessionId: string): Promise<void>;
|
|
82
|
+
|
|
83
|
+
// ─── Quota & Append ────────────────────────────────────
|
|
84
|
+
imapGetQuota(sessionId: string, root: string | null): Promise<string>;
|
|
85
|
+
imapAppendMessage(
|
|
86
|
+
sessionId: string,
|
|
87
|
+
mailbox: string,
|
|
88
|
+
rawMimeData: string,
|
|
89
|
+
flagsJson: string | null
|
|
90
|
+
): Promise<string>;
|
|
91
|
+
|
|
92
|
+
// ═══ SMTP ═══════════════════════════════════════════════
|
|
93
|
+
smtpConnect(configJson: string): Promise<string>;
|
|
94
|
+
smtpDisconnect(sessionId: string): Promise<void>;
|
|
95
|
+
smtpSendMail(sessionId: string, optionsJson: string): Promise<string>;
|
|
96
|
+
smtpVerifyConnection(sessionId: string): Promise<boolean>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// TurboModule 的注册名,必须与 C++ 端的注册名一致
|
|
100
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('EmailImapSmtp');
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// react-native-email-imap-smtp — Main Entry
|
|
3
|
+
// ============================================================
|
|
4
|
+
//
|
|
5
|
+
// Platform resolution:
|
|
6
|
+
// iOS / Android / Windows → native.ts → Nitro HybridObject
|
|
7
|
+
// Web / other → web.ts → throws not-supported
|
|
8
|
+
// ============================================================
|
|
9
|
+
|
|
10
|
+
import { Platform } from 'react-native';
|
|
11
|
+
import type {
|
|
12
|
+
IMAPConfig,
|
|
13
|
+
SMTPConfig,
|
|
14
|
+
IMAPConnectionResult,
|
|
15
|
+
SMTPConnectionResult,
|
|
16
|
+
Mailbox,
|
|
17
|
+
MailboxStatus,
|
|
18
|
+
Folder,
|
|
19
|
+
Email,
|
|
20
|
+
Attachment,
|
|
21
|
+
FetchEmailsOptions,
|
|
22
|
+
SearchCriteria,
|
|
23
|
+
BatchResult,
|
|
24
|
+
IMAPNotification,
|
|
25
|
+
QuotaInfo,
|
|
26
|
+
AppendResult,
|
|
27
|
+
SendMailOptions,
|
|
28
|
+
SendMailResult,
|
|
29
|
+
EmailError,
|
|
30
|
+
} from './types';
|
|
31
|
+
|
|
32
|
+
export type {
|
|
33
|
+
IMAPConfig,
|
|
34
|
+
SMTPConfig,
|
|
35
|
+
IMAPConnectionResult,
|
|
36
|
+
SMTPConnectionResult,
|
|
37
|
+
Mailbox,
|
|
38
|
+
MailboxStatus,
|
|
39
|
+
Folder,
|
|
40
|
+
Email,
|
|
41
|
+
Attachment,
|
|
42
|
+
FetchEmailsOptions,
|
|
43
|
+
SearchCriteria,
|
|
44
|
+
BatchResult,
|
|
45
|
+
IMAPNotification,
|
|
46
|
+
QuotaInfo,
|
|
47
|
+
AppendResult,
|
|
48
|
+
SendMailOptions,
|
|
49
|
+
SendMailResult,
|
|
50
|
+
EmailError,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// ─── Platform-aware module resolution ──────────────────────
|
|
54
|
+
|
|
55
|
+
let impl: any;
|
|
56
|
+
|
|
57
|
+
if (Platform.OS === 'android') {
|
|
58
|
+
// Android 使用 NitroModules HybridObject
|
|
59
|
+
impl = require('./native');
|
|
60
|
+
} else if (Platform.OS === 'windows') {
|
|
61
|
+
// Windows 使用 TurboModule 降级方案(NitroModules 无官方 Windows 运行时)
|
|
62
|
+
impl = require('./windows');
|
|
63
|
+
} else if (Platform.OS === 'ios') {
|
|
64
|
+
throw new Error(
|
|
65
|
+
'EmailImapSmtp: iOS implementation is not ready yet. ' +
|
|
66
|
+
'Only Android and Windows are currently supported.'
|
|
67
|
+
);
|
|
68
|
+
} else {
|
|
69
|
+
// Web 等其他平台
|
|
70
|
+
impl = require('./web');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// ─── IMAP exports ───────────────────────────────────────────
|
|
74
|
+
|
|
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>;
|
|
155
|
+
|
|
156
|
+
// ─── SMTP exports ──────────────────────────────────────────
|
|
157
|
+
|
|
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>;
|