You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've lately ran into problems when having mailboxes that end in a whitespace. As the constructor of the mailbox class trims the imapPath it's tricky to make it work with mailboxes which names really do end in whitespaces. For example I'd have had problems with "INBOX.Meeting Requests ".
I've now solved my problem by checking whether the name of my folder is equal to the trimmed version. If not I call the switchMailbox function on the mailbox instantly after constructing the mailbox with the same path again, because the switchMailbox function does not trim the imapPath.
Is there a cleaner way to supply an imapPath with a folder which name ends in a whitespace?
The text was updated successfully, but these errors were encountered:
I've added an argument to optionally disable the whitespace trimming for the IMAP path:
$mailbox = newPhpImap\Mailbox(
$imapPath, // IMAP server and mailbox folder$login, // Username for the before configured mailbox$password, // Password for the before configured username$attachmentsDir = null, // Directory, where attachments will be saved (optional)$serverEncoding = 'UTF-8', // Server encoding (optional)$trimImapPath = true// Trim leading/ending whitespaces of IMAP path (optional)
);
Setting $trimImapPath to false will disable the whitespace trimming and solve your problem.
I've lately ran into problems when having mailboxes that end in a whitespace. As the constructor of the mailbox class trims the imapPath it's tricky to make it work with mailboxes which names really do end in whitespaces. For example I'd have had problems with "INBOX.Meeting Requests ".
I've now solved my problem by checking whether the name of my folder is equal to the trimmed version. If not I call the switchMailbox function on the mailbox instantly after constructing the mailbox with the same path again, because the switchMailbox function does not trim the imapPath.
Is there a cleaner way to supply an imapPath with a folder which name ends in a whitespace?
The text was updated successfully, but these errors were encountered: