Clivern / Imap

:mailbox_with_mail: Access Mailbox Using PHP IMAP.
MIT License
31 stars 16 forks source link

SINCE code example in Readme.md has mistake #2

Closed ryckblick closed 5 years ago

ryckblick commented 5 years ago

The code example suggest a usage as follows: $search->addCondition(new Since(date("j F Y")));

If you do it like this, it throws a Notice: Unknown search criterion: SINCE (errflg=2) and stops working. You should use SINCE without date() as suggested in http://php.net/manual/en/function.imap-search.php Example 1

If the code example was $search->addCondition(new Since("j F Y")); instead. Everything works fine. Cheers! :)

Clivern commented 5 years ago

@AgenturSofa are you sure of this since on the example

$some   = imap_search($conn, 'SUBJECT "HOWTO be Awesome" SINCE "8 August 2008"', SE_UID);

in the readme

$search->addCondition(new Since(date("j F Y")))
# will be 
$search->addCondition("SINCE \"12 November 2018\"");
    public function __construct($data)
    {
        $this->data = $data;
    }
    /**
     * Query String
     *
     * @return string
     */
    public function __toString()
    {
        return "SINCE \"{$this->data}\"";
    }
ryckblick commented 5 years ago

Aw crap. I used the example wrong... I'm so sorry. Is there a way to delete the issue?

Clivern commented 5 years ago

no problem, that is fine. at least your issue solved!