Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Optional trimming of imap path on initialization of mailbox #603

Closed
timkrase opened this issue Jun 22, 2021 · 2 comments
Closed
Labels
needs investigation This will be tested / debugged or checked out.

Comments

@timkrase
Copy link

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?

@timkrase timkrase added the needs investigation This will be tested / debugged or checked out. label Jun 22, 2021
@Sebbo94BY
Copy link
Collaborator

Check out the develop branch.

I've added an argument to optionally disable the whitespace trimming for the IMAP path:

$mailbox = new PhpImap\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.

@Sebbo94BY Sebbo94BY mentioned this issue Dec 27, 2021
@Sebbo94BY
Copy link
Collaborator

This change is included in the release 4.3.0 and newer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs investigation This will be tested / debugged or checked out.
Projects
None yet
Development

No branches or pull requests

2 participants