made 3 options for incomming mail: reply on ticket, new ticket and nothing related to that. When it's nothing related to that the mail will stay in the mailbox untill it get's manually read and deleted!

--HG--
branch : quitta-gsoc-2013
This commit is contained in:
Quitta 2013-08-17 19:07:00 +02:00
parent 483045c613
commit 69192712a0
3 changed files with 30 additions and 20 deletions

View file

@ -149,17 +149,18 @@ class Mail_Handler{
for ($i = 1; $i <= $message_count; ++$i) {
//return task ID
self::incoming_mail_handler($mbox, $i,$group);
$tid = 1; //self::ams_create_email($from, $subject, $txt, $html, $to, $from);
$tid = self::incoming_mail_handler($mbox, $i,$group);
if($tid) {
//TODO: base file on Ticket + reply id
/* $file = fopen($MAIL_DIR."/mail/".$tid, 'w');
//TODO: base file on Ticket + timestamp
$file = fopen($MAIL_DIR."/mail/ticket".$tid.".".time(), 'w');
fwrite($file, $entire_email);
fclose($file); */
fclose($file);
//mark message $i of $mbox for deletion!
imap_delete($mbox, $i);
}
//mark message $i of $mbox for deletion!
imap_delete($mbox, $i);
}
//delete marked messages
imap_expunge($mbox);
@ -252,23 +253,30 @@ class Mail_Handler{
if((Ticket_User::isMod($user) or ($ticket->getAuthor() == $user->getTUserId())) and $txt != ""){
Ticket::createReply($txt, $user->getTUserId(), $ticket->getTId(), 0);
}
}
print("\n Email found that is a reply to a ticket!\n");
return $ticket_id;
}else{
}else if($from != "FALSE"){
//if ticket_id isn't found, create a new ticket!
//if an existing email address mailed the ticket
if($from != "FALSE"){
$newTicketId = Ticket::create_Ticket($subject, $txt,1, $from, $from);
//if not default group, then forward it!
if($group->getSGroupId()){
Ticket::forwardTicket(0, $newTicketId, $group->getSGroupId());
}
}
$newTicketId = Ticket::create_Ticket($subject, $txt,1, $from, $from);
//if not default group, then forward it!
if($group->getSGroupId()){
Ticket::forwardTicket(0, $newTicketId, $group->getSGroupId());
}
print("\n Email found that is a new ticket!\n");
return $newTicketId;
}else{
//if it's a email that has nothing to do with ticketing, return 0;
print("\n Email found that isn't a reply or new ticket!\n");
return 0;
}
}

View file

@ -42,7 +42,7 @@ $cfg['db']['ring']['pass'] = '';
// To connect to a remote server replace "localhost" with the name or the IP address of the server you want to connect to.
//$cfg['mail']['server'] = '{localhost:110/pop3/novalidate-cert}INBOX';
$cfg['mail']['default_mailserver']= '{imap.gmail.com:993/imap/ssl}INBOX';
$cfg['mail']['default_groupemail'] = 'support@ryzomcore.com';
$cfg['mail']['default_groupemail'] = 'amsryzom@gmail.com';
$cfg['mail']['default_groupname'] = 'Ryzomcore Support';
$cfg['mail']['default_username'] = 'amsryzom@gmail.com';
$cfg['mail']['default_password'] = 'lol123bol';

View file

@ -81,7 +81,9 @@ class WebUsers extends Users{
$dbw = new DBLayer("web");
$statement = $dbw->execute("SELECT * FROM ams_user WHERE Email=:email", array('email' => $email));
$row = $statement->fetch();
if($row !== "FALSE"){
if(!empty($row)){
print "shouldn't be here!" . $row . "seee";
return $row['UId'];
}else{
return "FALSE";