PDA

View Full Version : POP3 Fetch imports Tickets many times !


isaBERLIN
12-16-2007, 01:52 AM
See screenshot :
It doesnt delete the message from inbox in time and imports it many times


http://img1.getpic.info/MTYxMjA3/766boserror_010.png

i recived 267 overlimit messages so far ...
the mail is still in the pop3 mailbox even though importet for over 200 times now

http://img1.getpic.info/MTYxMjA3/320foserror_011.png

akhusial
12-19-2007, 11:51 AM
I seem to be getting the same problem. POP would retrieve the same email several times.

isaBERLIN
12-19-2007, 12:11 PM
We ware working on that issue :)
meanwhile try this :
set "Maximum Open Tickets:" to 1
deactivate "Ticket Denied Notice:"that should work out for the meantime

cmo
02-28-2008, 06:47 AM
We ware working on that issue :)
meanwhile try this :
set "Maximum Open Tickets:" to 1
deactivate "Ticket Denied Notice:"that should work out for the meantime

Has this issue been solved? I am using 1.6rc3 and I have the same issue as the other user mentioned.

Spooky
03-02-2008, 05:35 AM
Hy,

I'm using the latest release and I have the same problem. Cron doesn't delete the mails from pop3 mailbox after fetch.

Thanks in advance for your help

Visor1999
03-04-2008, 08:09 AM
No real solution for this yet? I want the mails not to be deleted from the server. It should be possible to fetch the mails in osTicket (every mail only once!) and keep them on the server.
Maybe there's an ID for every mail on the POP3 server and osTicket could save in the database which IDs have already been downloaded?

Zoidberg
03-04-2008, 02:09 PM
Your fetch process is stuck in a loop.

One or several functions are called over and over again or some while {} operation is not properly closed.

You might have modified any files and will need to revert that change.

Visor1999
03-05-2008, 06:11 AM
I can't find any change I have made that may cause such a behaviour.

But I've got a question regarding the source code in class.pop3.php:


function fetchTickets($emailid,$max=20,$deletemsgs=false){

$nummsgs=imap_num_msg($this->mbox);
//echo 'New Emails: '. $nummsgs;
for($i=1; $i<=$nummsgs; $i++){
if($this->createTicket($i,$emailid)){
if($deletemsgs)
imap_delete($this->mbox,$i);
}
if($max && $i>=$max)
break;
}
@imap_expunge($this->mbox);
db_query('UPDATE '.POP3_TABLE.' SET errors=0, lastfetch=NOW() WHERE email_id='.db_input($emailid));

return $i;
}

The function is called via $pop3->fetchTickets($row['email_id'],30,$row['delete_msgs']?true:false);

Now, osTicket fetches only 30 mails from the server. And then, 5 minutes later, it fetches again 30 mails - but unfortunately exactly the same 30 messages. Of course it does, because although $nummsgs is getting bigger with every new mail on the server the loop still starts with 1 and breaks with 30.

I think here is missing a mechanism which checks if the mail has already been imported.

And: There needs to be a way to ensure that closed or deleted tickets are not created anew if the messages are still on the server (we don't delete mails from the server, we use IMAP&POP3 and keep the mails)

cmo
03-05-2008, 08:20 AM
I have been looking at the code since yesterday too, I even set this to true in the code to force it to delete the mail but it still wont delete it. Not only by setting the value being passed to the function to 1, but by also removing the if so that it will complete the task.



function fetchTickets($emailid,$max=20,$deletemsgs=true){

$nummsgs=imap_num_msg($this->mbox);
//echo 'New Emails: '. $nummsgs;
for($i=1; $i<=$nummsgs; $i++){
if($this->createTicket($i,$emailid)){
// if($deletemsgs) // COMMENTED OUT
// imap_delete($this->mbox,$i); // COMMENTED OUT

imap_delete($this->mbox,'1:*'); // remove all messages from inbox

//imap_delete($this->mbox,$i);
}


Question: Perhaps this is a mail server issue? Im using exchange is the same thing happening on postfix etc?

cmo
03-06-2008, 06:44 AM
I also seem to get this in my logs, so it looks like its bombing out before it can ever cleanup

php: IMAP toolkit crash: imap_cap called on non-IMAP stream!

I have written my own code which clears the mailbox but it never runs, even if its its used in the correct create ticket function.

cmo
03-10-2008, 07:05 AM
in the cron.php file, I have put some debugging, it appears that the code crashes before it completes

Cron::POP3(); //pop3 mail fetch

It will create the tickets but never delete the old ones. I have written my own delete script which runs after the ticket creation which clears the inbox.

ITEHQ
03-11-2008, 06:38 AM
I too am having the same issue with RC3.

At first I thought one of the techs doing some testing had broke something and have removed all other departments and emails addresses but yet it still keeps on updating tickets over and over again with different ticket ids. which is not secure at all. I was hoping to go live with my company and use this feature but too bad I was a week away from using it. May have to go backto RC2 to go LIVE in ONE WEEK.

I have the corrections as stated by setting maximum open ticket to one and disabling over limit notice. Seems to be working will update if something further changes.

Please update on any further corrections that may be needed....

styloa
06-26-2008, 10:47 AM
then it went away all by itself!

While I was browsing this forum it stopped happening. Emails get deleted as they are fetched. Curious.

One bit of info that might be useful - the new tickets/comments on existing tickets were appearing faster than the 5 minute interval.....

So it seems the email fetch was either ignoring or not updating lastfetch in ost_email_pop3 table.

But like I said.. .as I got my sleeves rolled up to debug this it just stopped happening. pop3->fetchTickets() gets called like clockwork every 5 minutes and emails get deleted of my pop3 server.

Nice work osTicket team! Great little piece of software - I'm in the process of hacking up a joomla module for osTicket.

Cheers,
Adam.

roomee
03-18-2010, 11:23 AM
fetching enabled only on staff activity.

Admin syslog shows auto cron,

while I didn't put the forwarding url in mail setup.


I did make some changes in fetch method, but thats for the email formatting .

Any wisdom is welcome

Peace