| @@ 429-442 (lines=14) @@ | ||
| 426 | * | |
| 427 | * @return Mailbox The best candidate for the "drafts" inbox | |
| 428 | */ | |
| 429 | 	public function getDraftsFolder() { | |
| 430 | // check for existence | |
| 431 | 		$draftsFolder = $this->getSpecialFolder('drafts', true); | |
| 432 | 		if (count($draftsFolder) === 0) { | |
| 433 | // drafts folder does not exist - let's create one | |
| 434 | $conn = $this->getImapConnection(); | |
| 435 | // TODO: also search for translated drafts mailboxes | |
| 436 | 			$conn->createMailbox('Drafts', [ | |
| 437 | 'special_use' => ['drafts'], | |
| 438 | ]); | |
| 439 | 			return $this->guessBestMailBox($this->listMailboxes('Drafts')); | |
| 440 | } | |
| 441 | return $draftsFolder[0]; | |
| 442 | } | |
| 443 | ||
| 444 | /** | |
| 445 | * @return IMailBox | |
| @@ 457-470 (lines=14) @@ | ||
| 454 | * | |
| 455 | * @return Mailbox The best candidate for the "sent mail" inbox | |
| 456 | */ | |
| 457 | 	public function getSentFolder() { | |
| 458 | //check for existence | |
| 459 | 		$sentFolders = $this->getSpecialFolder('sent', true); | |
| 460 | 		if (count($sentFolders) === 0) { | |
| 461 | //sent folder does not exist - let's create one | |
| 462 | $conn = $this->getImapConnection(); | |
| 463 | //TODO: also search for translated sent mailboxes | |
| 464 | 			$conn->createMailbox('Sent', [ | |
| 465 | 'special_use' => ['sent'], | |
| 466 | ]); | |
| 467 | 			return $this->guessBestMailBox($this->listMailboxes('Sent')); | |
| 468 | } | |
| 469 | return $sentFolders[0]; | |
| 470 | } | |
| 471 | ||
| 472 | /** | |
| 473 | * @param string $sourceFolderId | |