GithubHelp home page GithubHelp logo

Comments (11)

olealgoritme avatar olealgoritme commented on August 22, 2024

Why don't you just pull...?

from php-imap.

tetrode avatar tetrode commented on August 22, 2024

Hi

I'm a bit new to all these terms (pull, fork, etc).

Do you mean get your source and write it myself and contribute back? I've
been thinking about it...

Best

Mark

On Wed, Jun 11, 2014 at 5:40 PM, thailemon [email protected] wrote:

Why don't you just pull...?


Reply to this email directly or view it on GitHub
#57 (comment).

from php-imap.

barbushin avatar barbushin commented on August 22, 2024

@tetrode Yes, just make a fork, commit your changes, and proceed pull request. There is a lot information in Google how to do this :) Right now I don't have enough free time to do this by myself.

from php-imap.

tetrode avatar tetrode commented on August 22, 2024

Thanks, I will surely find this on google!

On Wed, Jun 11, 2014 at 5:45 PM, Sergey [email protected] wrote:

@tetrode https://github.com/tetrode Yes, just make a fork, commit your
changes, and proceed pull request. There is a lot information in Google how
to do this :)


Reply to this email directly or view it on GitHub
#57 (comment).

from php-imap.

zgmunshi avatar zgmunshi commented on August 22, 2024

@tetrode Hi,
I too am using this library but now looking to implement imap idle in it.If you have made any progress kindly let me know.

Regards,
Zeeshan.

from php-imap.

tetrode avatar tetrode commented on August 22, 2024

Hi Zeeshan

I have been looking into the IDLE / NOTIFY extension of the IMAP protocol.
It works basically as follows:

-> telnet to IMAP server
-> login with user, password
-> say IDLE to the remote server
-> wait in a blocking get
-> when new mail comes in, the server will inform you

Due to this blocking get (you never know when the next e-mail is coming in)
this is not suitable for php scripts that run in a web browser.

It can serve in a php script that runs as a daemon (this is how I will use
it).

I have a semi working script here, you can use the code - no license
attached :-)

http://pastebin.com/faXTpAWs

Best

Mark

On Wed, Aug 13, 2014 at 3:22 PM, Zeeshan [email protected] wrote:

@tetrode https://github.com/tetrode Hi,
I too am using this library but now looking to implement imap idle in
it.If you have made any progress kindly let me know.

Regards,
Zeeshan.


Reply to this email directly or view it on GitHub
#57 (comment).

from php-imap.

zgmunshi avatar zgmunshi commented on August 22, 2024

Thanks Mark.

Will surely give it a try.

On Wed, Aug 13, 2014 at 9:00 AM, tetrode [email protected] wrote:

Hi Zeeshan

I have been looking into the IDLE / NOTIFY extension of the IMAP protocol.
It works basically as follows:

-> telnet to IMAP server
-> login with user, password
-> say IDLE to the remote server
-> wait in a blocking get
-> when new mail comes in, the server will inform you

Due to this blocking get (you never know when the next e-mail is coming
in)
this is not suitable for php scripts that run in a web browser.

It can serve in a php script that runs as a daemon (this is how I will use
it).

I have a semi working script here, you can use the code - no license
attached :-)

http://pastebin.com/faXTpAWs

Best

Mark

On Wed, Aug 13, 2014 at 3:22 PM, Zeeshan [email protected]
wrote:

@tetrode https://github.com/tetrode Hi,
I too am using this library but now looking to implement imap idle in
it.If you have made any progress kindly let me know.

Regards,
Zeeshan.

Reply to this email directly or view it on GitHub
#57 (comment).

Reply to this email directly or view it on GitHub
#57 (comment).

from php-imap.

pguptaoctal avatar pguptaoctal commented on August 22, 2024

Dear tetrode,

I am also looking for the same thing, did you get it, if yes then please share with me ?

Regards
Pankaj

from php-imap.

tetrode avatar tetrode commented on August 22, 2024

I have been looking into the IDLE / NOTIFY extension of the IMAP protocol.
It works basically as follows:

-> telnet to IMAP server
-> login with user, password
-> say IDLE to the remote server
-> wait in a blocking get
-> when new mail comes in, the server will inform you

Due to this blocking get (you never know when the next e-mail is coming in)
this is not suitable for php scripts that run in a web browser.

It can serve in a php script that runs as a daemon (this is how I will use
it).

I have a semi working script here, you can use the code - no license
attached :-)

http://pastebin.com/faXTpAWs

Best

Mark
On Sep 12, 2014 12:16 PM, "pguptaoctal" [email protected] wrote:

Dear tetrode,

I am also looking for the same thing, did you get it, if yes then please
share with me ?

Regards
Pankaj


Reply to this email directly or view it on GitHub
#57 (comment).

from php-imap.

Sebbo94BY avatar Sebbo94BY commented on August 22, 2024

As already stated: This is not possible for PHP scripts, which runs on a web server.

You can build such a functionality by using the PHP functions imap_ping and imap_check for PHP scripts, which will be executed on the CLI (as a daemon).

All PHP IMAP functions can be called / used by php-imap like this:

$mailbox->imap('ping');
$mailbox->imap('check');

Below an untested example code:

RECONNECT:
// Connect to mailbox
$mailbox = new PhpImap\Mailbox('{imap.gmail.com:993/imap/ssl}INBOX', '[email protected]', '*********', __DIR__);

CHECKMAILS:
// Search unseen (unread) mails
$mailsIds = $mailbox->searchMailbox('UNSEEN');

if(!$mailsIds) {
	echo 'Mailbox is empty. Waiting 60 seconds until next check...\n';
        sleep(60);

       // Clear IMAP cache to prevent high memory consumption
       $mailbox->imap('gc', array(IMAP_GC_ELT));

       if(!$mailbox->imap('ping')) {
              goto RECONNECT;
       }

       $mailbox_check = $mailbox->imap('check');

       if($mailbox_check->Recent > 0) {
              echo 'New emails arrived. Parsing them...\n';
              goto PARSEEMAILS;
       }
}

// Parse emails
PARSEEMAILS:
foreach($mailsIds as $mailId) {
       $mail = $mailbox->getMail($mailId);

       // Do something with $mail; eg. saving to database, sending autom. responses, ...
}

// Go back and check for new emails
goto CHECKMAILS;

Please note, that you should add a logic to restart the PHP script after some time.


References:

from php-imap.

dartrax avatar dartrax commented on August 22, 2024

@Sebbo94BY: Could you update your example code, as $mailbox->imap('ping'); does not work any more because the imap-function got removed (refactored?) in commit dab9937 ? Thanks :)

from php-imap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.