Ryzom Account Management System
1.0
|
Handles the mailing functionality. More...
Public Member Functions | |
cron () | |
the cron funtion (workhorse of the mailing system). | |
new_message_id ($ticketId) | |
creates a new message id for a email about to send. | |
get_ticket_id_from_subject ($subject) | |
try to fetch the ticket_id out of the subject. | |
incoming_mail_handler ($mbox, $i, $group) | |
Handles an incomming email Read the content of one email by using imap's functionality. | |
decode_utf8 ($str) | |
decode utf8 | |
get_mime_type (&$structure) | |
returns the mime type of a structure of a email | |
get_part ($stream, $msg_number, $mime_type, $structure=false, $part_number=false) | |
Static Public Member Functions | |
static | send_ticketing_mail ($receiver, $ticketObj, $content, $type, $sender=0) |
Wrapper for sending emails, creates the content of the email Based on the type of the ticketing mail it will create a specific email, it will use the language.ini files to load the correct language of the email for the receiver. | |
static | send_mail ($recipient, $subject, $body, $ticket_id=0, $from=NULL) |
send mail function that will add the email to the db. | |
Private Member Functions | |
mail_fork () | |
Start a new child process and return the process id this is used because imap might take some time, we dont want the cron parent process waiting on that. | |
Private Attributes | |
$db | |
db object used by various methods. |
Handles the mailing functionality.
This class covers the reading of the mail boxes of the support_groups, handling those emails, updating tickets accoring to the content & title of the emails, but also the sending of emails after creating a new ticket and when someone else replies on your ticket.
cron | ( | ) |
the cron funtion (workhorse of the mailing system).
The cron job will create a child process, which will first send the emails that are in the email table in the database, we use some kind of semaphore (a temp file) to make sure that if the cron job is called multiple times, it wont email those mails multiple times. After this, we will read the mail inboxes of the support groups and the default group using IMAP and we will add new tickets or new replies according to the incoming emails.
decode_utf8 | ( | $ | str | ) |
decode utf8
$str | str to be decoded |
get_mime_type | ( | &$ | structure | ) |
returns the mime type of a structure of a email
&$structure | the structure of an email message. |
get_part | ( | $ | stream, |
$ | msg_number, | ||
$ | mime_type, | ||
$ | structure = false , |
||
$ | part_number = false |
||
) |
get_ticket_id_from_subject | ( | $ | subject | ) |
try to fetch the ticket_id out of the subject.
The subject should have a substring of the form [Ticket #ticket_id], where ticket_id should be the integer ID of the ticket.
$subject | the subject of an incomming email. |
incoming_mail_handler | ( | $ | mbox, |
$ | i, | ||
$ | group | ||
) |
Handles an incomming email Read the content of one email by using imap's functionality.
If a ticket id is found inside the message_id or else in the subject line, then a reply will be added (if the email is not being sent from the authors email address it won't be added though and a warning will be sent to both parties). If no ticket id is found, then a new ticket will be created.
$mbox | a mailbox object |
$i | the email's id in the mailbox (integer) |
$group | the group object that owns the inbox. |
mail_fork | ( | ) | [private] |
Start a new child process and return the process id this is used because imap might take some time, we dont want the cron parent process waiting on that.
new_message_id | ( | $ | ticketId | ) |
creates a new message id for a email about to send.
$ticketId | the ticket id of the ticket that is mentioned in the email. |
static send_mail | ( | $ | recipient, |
$ | subject, | ||
$ | body, | ||
$ | ticket_id = 0 , |
||
$ | from = NULL |
||
) | [static] |
send mail function that will add the email to the db.
this function is being used by the send_ticketing_mail() function. It adds the email as an entry to the `email` table in the database, which will be sent later on when we run the cron job.
$recipient | if integer, then it refers to the id of the user to whom we want to mail, if it's a string(email-address) then we will use that. |
$subject | the subject of the email |
$body | the body of the email |
$ticket_id | the id of the ticket |
$from | the sending support_group's id (NULL in case the default group is sending)) |
static send_ticketing_mail | ( | $ | receiver, |
$ | ticketObj, | ||
$ | content, | ||
$ | type, | ||
$ | sender = 0 |
||
) | [static] |
Wrapper for sending emails, creates the content of the email Based on the type of the ticketing mail it will create a specific email, it will use the language.ini files to load the correct language of the email for the receiver.
Also if the $TICKET_MAILING_SUPPORT is set to false or if the user's personal 'ReceiveMail' entry is set to false then no mail will be sent.
$receiver | if integer, then it refers to the id of the user to whom we want to mail, if it's a string(email-address) then we will use that. |
$ticketObj | the ticket object itself, this is being used for including ticket related information into the email. |
$content | the content of a reply or new ticket |
$type | REPLY, NEW, WARNAUTHOR, WARNSENDER, WARNUNKNOWNSENDER |
$sender | (default = 0 (if it is not forwarded)) else use the id of the support group to which the ticket is currently forwarded, the support groups email address will be used to send the ticket. |
$db [private] |
db object used by various methods.