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
// composer packages loadrequire_once"vendor/autoload.php";
usePhpImap\Exceptions\ConnectionException;
usePhpImap\Mailbox;
$mailbox = newMailbox(
'{imap.yandex.com.tr:993/imap/ssl/novalidate-cert}INBOX', // IMAP server and mailbox folder'gdemir3327@yandex.com', // 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)
);
// Save attachments one by one$count_email_attachments = count($email->getAttachments());
if ($count_email_attachments != 0) {
$attachments = $email->getAttachments();
foreach ($attachmentsas$attachment) {
echo'--> Saving '.(string) $attachment->name.'...';
// Set individually filePath for each single attachment// In this case, every file will get the current Unix timestamp$attachment->setFilePath(__DIR__.'/upload/'. $attachment->name);
if ($attachment->saveToDisk()) {
echo"OK, saved!\n";
} else {
echo"ERROR, could not save!\n";
}
}
}
Screenshots / Outputs
Fatal error: Uncaught Error: Call to undefined method PhpImap\IncomingMailAttachment::setFilePath() in /var/www/vhosts/v9.haberpanelim.com/httpdocs/ir/index.php:57 Stack trace: #0 {main} thrown in /var/www/vhosts/v9.haberpanelim.com/httpdocs/ir/index.php on line 57
The text was updated successfully, but these errors were encountered:
The used code:
Screenshots / Outputs
Fatal error: Uncaught Error: Call to undefined method PhpImap\IncomingMailAttachment::setFilePath() in /var/www/vhosts/v9.haberpanelim.com/httpdocs/ir/index.php:57 Stack trace: #0 {main} thrown in /var/www/vhosts/v9.haberpanelim.com/httpdocs/ir/index.php on line 57
The text was updated successfully, but these errors were encountered: