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

[BUG] Uncaught Error: Call to undefined method PhpImap\IncomingMail::hasAttachments() #695

Open
gdemir opened this issue Jan 2, 2023 · 2 comments
Labels
needs investigation This will be tested / debugged or checked out.

Comments

@gdemir
Copy link

gdemir commented Jan 2, 2023

The used code:

// composer packages load
require_once "vendor/autoload.php";
use PhpImap\Exceptions\ConnectionException;
use PhpImap\Mailbox;
$mailbox = new Mailbox(
        '{imap.yandex.com.tr:993/imap/ssl/novalidate-cert}INBOX', // IMAP server and mailbox folder
        '[email protected]', // Username for the before configured mailbox
        '********', // Password for the before configured username
	__DIR__ . '/upload/', // Directory, where attachments will be saved (optional)
        'UTF-8', // Server encoding (optional)
         true, // Trim leading/ending whitespaces of IMAP path (optional)
         false // Attachment filename mode (optional; false = random filename; true = original filename)
     );
    echo 'mail has attachments? ';
    if ($email->hasAttachments()) {
        echo "Yes\n";
    } else {
        echo "No\n";
    }

Screenshots / Outputs
Fatal error: Uncaught Error: Call to undefined method PhpImap\IncomingMail::hasAttachments() in /var/www/vhosts/httpdocs/ir/index.php:53 Stack trace: #0 {main} thrown in /var/www/vhosts//httpdocs/ir/index.php on line 53

@gdemir gdemir added the needs investigation This will be tested / debugged or checked out. label Jan 2, 2023
@teamcoltra
Copy link

Popping in to say I also had this. I'm not dealing with attachments so it doesn't matter to me but it was in the demo code.

@teamcoltra
Copy link

Found the issue:
use
composer require php-imap/php-imap:dev-master

as the main one is super old and out of date.

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