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

Add support for original filename for attachments #633

Merged
merged 1 commit into from
Nov 26, 2021

Conversation

Sebbo94BY
Copy link
Collaborator

Either directly in the constructor:

// Create PhpImap\Mailbox instance for all further actions
$mailbox = new PhpImap\Mailbox(
    '{imap.gmail.com:993/imap/ssl}INBOX', // IMAP server and mailbox folder
    'some@gmail.com', // Username for the before configured mailbox
    '*********', // Password for the before configured username
    __DIR__, // Directory, where attachments will be saved (optional)
    'UTF-8', // Server encoding (optional)
    true, // Trim leading/ending whitespaces of IMAP path (optional)
    true // Attachment filename mode (optional; false = random filename; true = original filename)
);

Or any time later in the code:

// set attachment filename mode to "original filename"
$mailbox->setAttachmentFilenameMode(true);

You also can get the current configuration:

// get current attachment filename mode
// true => original filename
// false => random filename (default; old known behaviour by this library)
$mailbox->getAttachmentFilenameMode();

Resolves #589.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant