@weijingwei/email 1.0.5 → 1.0.6

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 CHANGED
@@ -82751,7 +82751,7 @@ async function getEmail(imapConfig, uid, folder = "INBOX") {
82751
82751
  return {
82752
82752
  uid,
82753
82753
  from: parsed.from?.text || "",
82754
- to: parsed.to?.map((a) => a.text) || [],
82754
+ to: extractAddresses(parsed.to),
82755
82755
  subject: parsed.subject || "(\u65E0\u4E3B\u9898)",
82756
82756
  date: parsed.date?.toISOString() || "",
82757
82757
  flags: item.attributes.flags || [],
@@ -82764,6 +82764,17 @@ async function getEmail(imapConfig, uid, folder = "INBOX") {
82764
82764
  connection.end();
82765
82765
  }
82766
82766
  }
82767
+ function extractAddresses(address) {
82768
+ if (!address)
82769
+ return [];
82770
+ if (Array.isArray(address)) {
82771
+ return address.map((a) => a.text);
82772
+ }
82773
+ if (typeof address === "object" && "text" in address) {
82774
+ return [address.text];
82775
+ }
82776
+ return [];
82777
+ }
82767
82778
  function extractAttachmentInfo(parsed) {
82768
82779
  if (!parsed.attachments || parsed.attachments.length === 0) {
82769
82780
  return [];
package/dist/cli.js CHANGED
@@ -65797,7 +65797,7 @@ async function getEmail(imapConfig, uid, folder = "INBOX") {
65797
65797
  return {
65798
65798
  uid,
65799
65799
  from: parsed.from?.text || "",
65800
- to: parsed.to?.map((a) => a.text) || [],
65800
+ to: extractAddresses(parsed.to),
65801
65801
  subject: parsed.subject || "(\u65E0\u4E3B\u9898)",
65802
65802
  date: parsed.date?.toISOString() || "",
65803
65803
  flags: item.attributes.flags || [],
@@ -65810,6 +65810,17 @@ async function getEmail(imapConfig, uid, folder = "INBOX") {
65810
65810
  connection.end();
65811
65811
  }
65812
65812
  }
65813
+ function extractAddresses(address) {
65814
+ if (!address)
65815
+ return [];
65816
+ if (Array.isArray(address)) {
65817
+ return address.map((a) => a.text);
65818
+ }
65819
+ if (typeof address === "object" && "text" in address) {
65820
+ return [address.text];
65821
+ }
65822
+ return [];
65823
+ }
65813
65824
  function extractAttachmentInfo(parsed) {
65814
65825
  if (!parsed.attachments || parsed.attachments.length === 0) {
65815
65826
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weijingwei/email",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Email MCP Server - SMTP/IMAP email operations via MCP protocol",
5
5
  "main": "dist/bundle.js",
6
6
  "bin": {