Hanle multiple mailaccounts

This commit is contained in:
Quitta 2013-08-16 22:24:11 +02:00
parent 420454f7f3
commit 70fdf0dc74
2 changed files with 36 additions and 29 deletions

View file

@ -60,8 +60,7 @@ class Mail_Handler{
global $cfg;
$default_groupemail = $cfg['mail']['default_groupemail'];
$default_groupname = $cfg['mail']['default_groupname'];
/*$inbox_username = $cfg['mail']['username'];
$inbox_password = $cfg['mail']['password'];
/*
$inbox_host = $cfg['mail']['host'];
$oms_reply_to = "Ryzom Ticketing Support <ticketing@".$inbox_host.">";
global $MAIL_DIR;*/
@ -133,8 +132,17 @@ class Mail_Handler{
unlink($pidfile);
}
// Check mail
$sGroups = Support_Group::getGroups();
$defaultGroup = new Support_Group();
$defaultGroup->setGroupEmail($default_groupemail);
$defaultGroup->setIMAP_MailServer($cfg['mail']['default_mailserver']);
$defaultGroup->setIMAP_Username($cfg['mail']['default_username']);
$defaultGroup->setIMAP_Password($cfg['mail']['default_password']);
$mbox = imap_open($cfg['mail']['server'], $inbox_username, $inbox_password) or die('Cannot connect to mail server: ' . imap_last_error());
$sGroups[] = $defaultGroup;
foreach($sGroups as $group){
$mbox = imap_open($group->getIMAP_MailServer(), $group->getIMAP_Username(), $group->getIMAP_Password()) or die('Cannot connect to mail server: ' . imap_last_error());
$message_count = imap_num_msg($mbox);
for ($i = 1; $i <= $message_count; ++$i) {
@ -155,7 +163,7 @@ class Mail_Handler{
//delete marked messages
imap_expunge($mbox);
imap_close($mbox);
}
}
}

View file

@ -31,12 +31,6 @@ $cfg['db']['ring']['name'] = 'ring_open';
$cfg['db']['ring']['user'] = 'shard';
$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,
// 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");
@ -47,7 +41,12 @@ $cfg['mail']['password'] = 'lol123bol';
// 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.
//$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
// (in nel.user= nel.permission= ring.ring_user and ring.characters