Hanle multiple mailaccounts

--HG--
branch : quitta-gsoc-2013
hg/feature/sse2
Quitta 11 years ago
parent 8262febe32
commit 2a02f35ae8

@ -60,8 +60,7 @@ class Mail_Handler{
global $cfg; global $cfg;
$default_groupemail = $cfg['mail']['default_groupemail']; $default_groupemail = $cfg['mail']['default_groupemail'];
$default_groupname = $cfg['mail']['default_groupname']; $default_groupname = $cfg['mail']['default_groupname'];
/*$inbox_username = $cfg['mail']['username']; /*
$inbox_password = $cfg['mail']['password'];
$inbox_host = $cfg['mail']['host']; $inbox_host = $cfg['mail']['host'];
$oms_reply_to = "Ryzom Ticketing Support <ticketing@".$inbox_host.">"; $oms_reply_to = "Ryzom Ticketing Support <ticketing@".$inbox_host.">";
global $MAIL_DIR;*/ global $MAIL_DIR;*/
@ -133,29 +132,38 @@ class Mail_Handler{
unlink($pidfile); unlink($pidfile);
} }
// Check mail // Check mail
$sGroups = Support_Group::getGroups();
$mbox = imap_open($cfg['mail']['server'], $inbox_username, $inbox_password) or die('Cannot connect to mail server: ' . imap_last_error()); $defaultGroup = new Support_Group();
$message_count = imap_num_msg($mbox); $defaultGroup->setGroupEmail($default_groupemail);
$defaultGroup->setIMAP_MailServer($cfg['mail']['default_mailserver']);
for ($i = 1; $i <= $message_count; ++$i) { $defaultGroup->setIMAP_Username($cfg['mail']['default_username']);
$defaultGroup->setIMAP_Password($cfg['mail']['default_password']);
//return task ID
self::incoming_mail_handler($mbox, $i); $sGroups[] = $defaultGroup;
$tid = 1; //self::ams_create_email($from, $subject, $txt, $html, $to, $from);
foreach($sGroups as $group){
if($tid) { $mbox = imap_open($group->getIMAP_MailServer(), $group->getIMAP_Username(), $group->getIMAP_Password()) or die('Cannot connect to mail server: ' . imap_last_error());
//TODO: base file on Ticket + reply id $message_count = imap_num_msg($mbox);
/* $file = fopen($MAIL_DIR."/mail/".$tid, 'w');
fwrite($file, $entire_email); for ($i = 1; $i <= $message_count; ++$i) {
fclose($file); */
//return task ID
self::incoming_mail_handler($mbox, $i);
$tid = 1; //self::ams_create_email($from, $subject, $txt, $html, $to, $from);
if($tid) {
//TODO: base file on Ticket + reply id
/* $file = fopen($MAIL_DIR."/mail/".$tid, 'w');
fwrite($file, $entire_email);
fclose($file); */
}
//mark message $i of $mbox for deletion!
imap_delete($mbox, $i);
} }
//mark message $i of $mbox for deletion! //delete marked messages
imap_delete($mbox, $i); imap_expunge($mbox);
imap_close($mbox);
} }
//delete marked messages
imap_expunge($mbox);
imap_close($mbox);
} }
} }

@ -31,12 +31,6 @@ $cfg['db']['ring']['name'] = 'ring_open';
$cfg['db']['ring']['user'] = 'shard'; $cfg['db']['ring']['user'] = 'shard';
$cfg['db']['ring']['pass'] = ''; $cfg['db']['ring']['pass'] = '';
$cfg['mail']['default_groupemail'] = 'support@ryzomcore.com';
$cfg['mail']['default_groupname'] = 'Ryzomcore Support';
$cfg['mail']['username'] = 'amsryzom@gmail.com';
$cfg['mail']['password'] = 'lol123bol';
//$cfg['mail']['host'] = 'ryzomcore.com';
// To connect to an IMAP server running on port 143 on the local machine, // To connect to an IMAP server running on port 143 on the local machine,
// do the following: $mbox = imap_open("{localhost:143}INBOX", "user_id", "password"); // do the following: $mbox = imap_open("{localhost:143}INBOX", "user_id", "password");
// POP3 server on port 110: $mbox = imap_open ("{localhost:110/pop3}INBOX", "user_id", "password"); // POP3 server on port 110: $mbox = imap_open ("{localhost:110/pop3}INBOX", "user_id", "password");
@ -47,7 +41,12 @@ $cfg['mail']['password'] = 'lol123bol';
// NNTP server on port 119 use: $nntp = imap_open ("{localhost:119/nntp}comp.test", "", ""); // NNTP server on port 119 use: $nntp = imap_open ("{localhost:119/nntp}comp.test", "", "");
// To connect to a remote server replace "localhost" with the name or the IP address of the server you want to connect to. // 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']['server'] = '{localhost:110/pop3/novalidate-cert}INBOX';
$cfg['mail']['server']= '{imap.gmail.com:993/imap/ssl}INBOX'; $cfg['mail']['default_mailserver']= '{imap.gmail.com:993/imap/ssl}INBOX';
$cfg['mail']['default_groupemail'] = 'support@ryzomcore.com';
$cfg['mail']['default_groupname'] = 'Ryzomcore Support';
$cfg['mail']['default_username'] = 'amsryzom@gmail.com';
$cfg['mail']['default_password'] = 'lol123bol';
//----------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------
// If true= the server will add automatically unknown user in the database // If true= the server will add automatically unknown user in the database
// (in nel.user= nel.permission= ring.ring_user and ring.characters // (in nel.user= nel.permission= ring.ring_user and ring.characters

Loading…
Cancel
Save