ddeboer / imap

Object-oriented, fully tested PHP IMAP library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Variable in Search not working.

luggesexe opened this issue · comments

Q A
ddeboer/imap version 1.13.1
PHP version 8.0.15
IMAP provider Own Server

Summary

Variable in Search not working properly.

Current behavior

I am trying to fetch E-Mails with a specific Address, for that I am fetching all the Addresses in the Database and foreach' any to the specific Mailbox. When I manually input the Address, it works properly $search->addCondition(new Ddeboer\Imap\Search\Email\From('mail@mail.eu')); or $messages = $mailbox->getMessages(new RawExpression('From "mail@mail.eu"'));. When I input the Variable as Mail, all the Mailboxes-Messages are fetched [both in SearchExpression aswell as RawExpression].

$messages = $mailbox->getMessages(new RawExpression('From "'.$Email.'"'));
There is a SO-Post, that also did not work [https://stackoverflow.com/questions/5086362/using-variables-in-imap-search-criteria].

Expected behavior

Only the E-Mails with the specified Filter shall be visible.

Kind regards,
Lukas-Adrian