Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3958942
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:40:09+00:00 2026-05-20T02:40:09+00:00

I am studying an application to trigger a PHP script based on new IMAP

  • 0

I am studying an application to trigger a PHP script based on new IMAP emails arriving on Gmail. What’s the best way to know a new email has arrived on a Gmail IMAP account? I can’t think of anything but to configure a cron job. I am running PHP + Nginx on a Linux (Ubuntu) box.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T02:40:10+00:00Added an answer on May 20, 2026 at 2:40 am

    I found out that that’s just the way celular companies developers are doing to verify their clients gmail.

    Well, start making the connection normaly, then:

    $t1=time();//mark time in
    $tt=$t1+(60*1);//total time = t1 + n seconds
    
    do{
        if(isset($t2)) unset($t2);//clean it at every loop cicle
        $t2=time();//mark time
        if(imap_num_msg($imap)!=0){//if there is any message (in the inbox)
    
            $mc=imap_check($imap);//messages check
            //var_dump($mc); die;//vardump it to see all the data it is possible to get with imap_check() and them customize it for yourself
    
    
        }else echo 'No new messagens';
    
        sleep(rand(7,13));//Give Google server a breack
        if(!@imap_ping($imap)){//if the connection is not up
            //start the imap connection the normal way like you did at first
        }
    
    }while($tt>$t2);//if the total time was not achivied yet, get back to the beginning of the loop
    

    And that’s it.

    By the way, here’s some good informations about how IMAP works. My point is that: as IMAP makes possible to mantain virtually a kind of “Live Sync” connection, if you don’t want to configure a MTA to receive email (like me), so IMAP is a real option for get “email pusshed” to you.

    • The connection stays active from 5 to 10 minutes each time you connect to your email, unless you manually disconnect
    • Gmail does limit each account to 10 simultaneous connections.
    • An IMAP account, though, shoud check the mailbox and then keep an active channel to the IMAP server (IMAP-IDLE) for the preset industry standard of 29 minutes before it times out. If you set your Auto-Retrieve setting to between 20-30 minutes, that should keep your phone connected to the remote IMAP box.
    • When GMAIL gets an email it should send a response to the IMAP idle session and mobiPush should pick it up almost instantly.
    • All schedule to retrieve your Gmail mail every 10 minutes, this option will sync incoming E-mail immediately when it arrives at the Gmail servers.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Studying C#, my books are showing me classes for readin files. I've found 2
Since I started studying object-oriented programming, I frequently read articles/blogs saying functions are better,
I've been studying the Google authentication API (AuthSub)... My question is, how do I
I am a student studying software development, and I feel programming, in general, is
I am studying for cryptography and I somehow stuck on understanding how DES works.
I am studying the content of Programming Ruby- The Pragmatic Programmer's Guide but the
Recently I have been studying recursion; how to write it, analyze it, etc. I
I've been studying OOP for quite a while now and I have a good
I am quantitatively studying various metrics associated with automated tests. Chrome seems to have
I am studying for an exam and I am confused as to how canonical

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.