ddeboer / imap

Object-oriented, fully tested PHP IMAP library
MIT License
887 stars 253 forks source link

Move message to another account #563

Closed Nayazkaya closed 1 year ago

Nayazkaya commented 1 year ago

Dear all,

I need to move (or copy & delete) messages from an account to another one. I've tried this :

$connection = $server->authenticate($Mail1, $Pass1);
$connection1 = $server->authenticate('$Mail2',$Pass2');

$mailbox = $connection->getMailbox('INBOX');
$mailbox1 = $connection1->getMailbox('INBOX');
$messages = $mailbox->getMessages();

foreach ($messages as $message )
{
        if ($message->getSubject() =="condition")
        {
            $message->move($mailbox1);
        }
}

but i doesn't work. Is it possible to do this ?

Slamdunk commented 1 year ago

Is it possible to do this ?

No

arwinvdv commented 1 year ago

You can use a tool like https://imapsync.lamiral.info/ for this. With for example exec() you can start this with PHP.

Nayazkaya commented 1 year ago

OK thanks