mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-24 15:56:22 +00:00
Hanle multiple mailaccounts
This commit is contained in:
parent
9893c2ef84
commit
efc8da6512
2 changed files with 36 additions and 29 deletions
|
@ -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,29 +132,38 @@ 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']);
|
||||
|
||||
$sGroups[] = $defaultGroup;
|
||||
|
||||
$mbox = imap_open($cfg['mail']['server'], $inbox_username, $inbox_password) or die('Cannot connect to mail server: ' . imap_last_error());
|
||||
$message_count = imap_num_msg($mbox);
|
||||
|
||||
for ($i = 1; $i <= $message_count; ++$i) {
|
||||
|
||||
//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); */
|
||||
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) {
|
||||
|
||||
//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!
|
||||
imap_delete($mbox, $i);
|
||||
//delete marked messages
|
||||
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']['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
|
||||
|
|
Loading…
Reference in a new issue