Skip to content

Commit 8ec557c

Browse files
refactor: add new folder mappings for gmail labels
1 parent a9d8fdb commit 8ec557c

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/Mail/Client/Imap/Util/DefaultFolderIdToTypeMapper.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public function getFolderType(ListMailFolder $listMailFolder): string
103103
// | INBOX
104104
// +------------------
105105
case "[GOOGLE MAIL]/ALLE NACHRICHTEN":
106+
case "[GMAIL]/ALLE NACHRICHTEN":
106107
case "INBOX":
107108
$type = MailFolder::TYPE_INBOX;
108109
break;
@@ -111,6 +112,7 @@ public function getFolderType(ListMailFolder $listMailFolder): string
111112
// | TRASH
112113
// +------------------
113114
case "[GOOGLE MAIL]/PAPIERKORB":
115+
case "[GMAIL]/PAPIERKORB":
114116
case "TRASH":
115117
case "JUNK-E-MAIL":
116118
case "DELETED":
@@ -127,6 +129,7 @@ public function getFolderType(ListMailFolder $listMailFolder): string
127129
// | DRAFT
128130
// +------------------
129131
case "[GOOGLE MAIL]/ENTWÜRFE":
132+
case "[GMAIL]/ENTWÜRFE":
130133
case "DRAFTS":
131134
case "DRAFT":
132135
case "ENTWÜRFE":
@@ -138,6 +141,7 @@ public function getFolderType(ListMailFolder $listMailFolder): string
138141
// | SENT
139142
// +------------------
140143
case "[GOOGLE MAIL]/GESENDET":
144+
case "[GMAIL]/GESENDET":
141145
case "GESENDETE ELEMENTE":
142146
case "GESENDET":
143147
case "SENT":
@@ -152,6 +156,7 @@ public function getFolderType(ListMailFolder $listMailFolder): string
152156
// | JUNK
153157
// +------------------
154158
case "[GOOGLE MAIL]/SPAM":
159+
case "[GMAIL]/SPAM":
155160
case "JUNK":
156161
case "SPAMVERDACHT":
157162
case "INBOX" . $delimiter . "JUNK":

tests/Mail/Client/Imap/Util/DefaultFolderIdToTypeMapperTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,30 @@ public function testGetFolderType()
195195
$this->createListMailFolder("Gesendet", ".")
196196
)
197197
);
198+
199+
200+
foreach (["Google Mail", "Gmail"] as $label) {
201+
$this->assertSame(
202+
MailFolder::TYPE_SENT,
203+
$mapper->getFolderType($this->createListMailFolder("[$label]/Gesendet", "."))
204+
);
205+
$this->assertSame(
206+
MailFolder::TYPE_DRAFT,
207+
$mapper->getFolderType($this->createListMailFolder("[$label]/Entwürfe", "."))
208+
);
209+
$this->assertSame(
210+
MailFolder::TYPE_INBOX,
211+
$mapper->getFolderType($this->createListMailFolder("[$label]/Alle Nachrichten", "."))
212+
);
213+
$this->assertSame(
214+
MailFolder::TYPE_JUNK,
215+
$mapper->getFolderType($this->createListMailFolder("[$label]/Spam", "."))
216+
);
217+
$this->assertSame(
218+
MailFolder::TYPE_TRASH,
219+
$mapper->getFolderType($this->createListMailFolder("[$label]/Papierkorb", "."))
220+
);
221+
}
198222
}
199223

200224

0 commit comments

Comments
 (0)