@weijingwei/email 1.0.4 → 1.0.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.
- package/dist/bundle.js +21 -1
- package/dist/cli.js +21 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -82590,6 +82590,10 @@ function validateSmtpConfig(config2) {
|
|
|
82590
82590
|
// src/services/imap.ts
|
|
82591
82591
|
var import_imap_simple = __toESM(require_imap_simple());
|
|
82592
82592
|
var import_mailparser = __toESM(require_mailparser());
|
|
82593
|
+
function isNeteaseMailbox(host) {
|
|
82594
|
+
const neteasePatterns = ["163.com", "126.com", "netease.com", "188.com"];
|
|
82595
|
+
return neteasePatterns.some((pattern) => host.includes(pattern));
|
|
82596
|
+
}
|
|
82593
82597
|
function createImapConfig(config2) {
|
|
82594
82598
|
return {
|
|
82595
82599
|
imap: {
|
|
@@ -82608,7 +82612,23 @@ function createImapConfig(config2) {
|
|
|
82608
82612
|
}
|
|
82609
82613
|
async function connectImap(config2) {
|
|
82610
82614
|
const imapConfig = createImapConfig(config2);
|
|
82611
|
-
|
|
82615
|
+
const connection = await import_imap_simple.default.connect(imapConfig);
|
|
82616
|
+
if (isNeteaseMailbox(config2.host) && connection.imap.serverSupports("ID")) {
|
|
82617
|
+
await new Promise((resolve, reject) => {
|
|
82618
|
+
connection.imap.id({
|
|
82619
|
+
name: "EmailMCP",
|
|
82620
|
+
version: "1.0",
|
|
82621
|
+
vendor: "Weijingwei",
|
|
82622
|
+
"support-email": config2.username
|
|
82623
|
+
}, (err) => {
|
|
82624
|
+
if (err)
|
|
82625
|
+
reject(err);
|
|
82626
|
+
else
|
|
82627
|
+
resolve();
|
|
82628
|
+
});
|
|
82629
|
+
});
|
|
82630
|
+
}
|
|
82631
|
+
return connection;
|
|
82612
82632
|
}
|
|
82613
82633
|
async function listEmails(imapConfig, folder = "INBOX", page = 1, pageSize = 20) {
|
|
82614
82634
|
const connection = await connectImap(imapConfig);
|
package/dist/cli.js
CHANGED
|
@@ -65636,6 +65636,10 @@ async function testSmtpConnection(config) {
|
|
|
65636
65636
|
// src/services/imap.ts
|
|
65637
65637
|
var import_imap_simple = __toESM(require_imap_simple());
|
|
65638
65638
|
var import_mailparser = __toESM(require_mailparser());
|
|
65639
|
+
function isNeteaseMailbox(host) {
|
|
65640
|
+
const neteasePatterns = ["163.com", "126.com", "netease.com", "188.com"];
|
|
65641
|
+
return neteasePatterns.some((pattern) => host.includes(pattern));
|
|
65642
|
+
}
|
|
65639
65643
|
function createImapConfig(config) {
|
|
65640
65644
|
return {
|
|
65641
65645
|
imap: {
|
|
@@ -65654,7 +65658,23 @@ function createImapConfig(config) {
|
|
|
65654
65658
|
}
|
|
65655
65659
|
async function connectImap(config) {
|
|
65656
65660
|
const imapConfig = createImapConfig(config);
|
|
65657
|
-
|
|
65661
|
+
const connection = await import_imap_simple.default.connect(imapConfig);
|
|
65662
|
+
if (isNeteaseMailbox(config.host) && connection.imap.serverSupports("ID")) {
|
|
65663
|
+
await new Promise((resolve, reject) => {
|
|
65664
|
+
connection.imap.id({
|
|
65665
|
+
name: "EmailMCP",
|
|
65666
|
+
version: "1.0",
|
|
65667
|
+
vendor: "Weijingwei",
|
|
65668
|
+
"support-email": config.username
|
|
65669
|
+
}, (err) => {
|
|
65670
|
+
if (err)
|
|
65671
|
+
reject(err);
|
|
65672
|
+
else
|
|
65673
|
+
resolve();
|
|
65674
|
+
});
|
|
65675
|
+
});
|
|
65676
|
+
}
|
|
65677
|
+
return connection;
|
|
65658
65678
|
}
|
|
65659
65679
|
async function listEmails(imapConfig, folder = "INBOX", page = 1, pageSize = 20) {
|
|
65660
65680
|
const connection = await connectImap(imapConfig);
|