HelpSpot Help Desk Software | HelpSpot Blog | HelpSpot Support

Need tasks.php to reprocess all the emails in a gmail account



I’ve had tasks.php process a bunch of emails in a gmail account for testing on a beta server. Now I need tasks.php to process them again to move them into production. However, tasks.php won’t touch emails that have been previously moved into the old system. How can I get tasks.php to reprocess all the emails in my gmail account so I can get them into production?



Hi Edward,

First make sure they’re in your gmail inbox and not an archive, it can only see the inbox.

If they are it may be hitting the duplicate email protection. First, make sure your system time is correct. Next, go into Admin->Settings->Email Integration and set “duplicate email protection” to 0.

See if that fixes it.

If not try setting tasks.php debugging to yes and running tasks.php via the browser to get more information about what it thinks the emails are.


Hi Ian,

Thanks for the reply. Unfortunately I am still experiencing the problem. Is there anything else you can think of that might be causing this?

It might be helpful to know that even on mails that a gmail account receives now, if our beta helpspot pulls that email before our production helpspot does, our production helpspot won’t get it. This is also true vice versa: if our production helpspot gets an e-mail from gmail, our beta helpspot won’t get it.

I set tasks.php debugging on. As an example, I ran the script on production first, and got the email, then tried to run the script on our beta, and didn’t get it:


Connecting to:

Message Count: 1
Message: #1 - Time (start parse): 0.00006
Message: #1 - Time (network download): 0.25855
Message: #1 - Time (mime decode): 0.25940
Message: #1 - Time (mime loop): 0.25952
Message: #1 - Time (forward check): 0.25955
Message: #1 - Time (empty html check): 0.26443
Message: #1 - Time (clean whitespace): 0.26448
Message: #1 - foo
Message: #1 - Time (header set): 0.26527
Message: #1 - Time (attachments): 0.26533
Message: #1 - Request created (69605)
Message: #1 - Marked for deletion from mailserver
Message: #1 - Time (total): 0.27190

Expunged messages marked for deletion
Closed connection to:


Connecting to:

Closed connection to:



Oh, yes. I didn’t realize you were running both of them. You shouldn’t do that, HelpSpot deletes the email from the mail account after it pulls it down. So just make the mailbox inactive in the test account and then the production one will pull in all the email from this point forward.


On our helpspot setup, the emails it pulls do not actually get removed from gmail though. For example, after running tasks.php as mentioned above, I can still see and read the email in my gmail account. This is actually good for us. However, if one of our servers pulls an email from it, the other one still ignores the email even though it’s still sitting in my gmail account. It would be great if I could get our production helpspot server to pull emails that were already pulled by our beta helpspot server.


Perhaps, I think gmail does save them even if HelpSpot tells them to be deleted.


Unfortunately marking them all as unread didn’t work. Do you guys have any other ideas?


Yeah that should work. I don’t know though if Gmail has a way to forward that will maintain the original person as the sender and not your primary account as the sender. Worst case you could just manually enter them in production, just be sure your test systems mailbox is offline so you don’t hit this in the future, or give it it’s own mailbox so you can safely test.

I think the problem with marking unread is that gmail knows they’re deleted and is keeping them marked as such when HelpSpot attempts to connect via imap even though in the web UI you’re seeing them.


Actually we recently found out in Gmail that any time we select “Enable POP for all mail (even mail that’s already been downloaded)” on a mail account, tasks.php will pick up all the emails again. Thanks for the input though!


Ah, well there you go. Thanks for letting us know.