Ryzom Account Management System  1.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
Mail_Handler Class Reference

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.

Detailed Description

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.

Author:
Daan Janssens, mentored by Matthew Lagoe

Member Function Documentation

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

Parameters:
$strstr to be decoded
Returns:
decoded string
get_mime_type ( &$  structure)

returns the mime type of a structure of a email

Parameters:
&$structurethe structure of an email message.
Returns:
"TEXT", "MULTIPART","MESSAGE", "APPLICATION", "AUDIO","IMAGE", "VIDEO", "OTHER","TEXT/PLAIN"
Todo:
take care of the HTML part of incoming emails.
get_part ( stream,
msg_number,
mime_type,
structure = false,
part_number = false 
)

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.

Parameters:
$subjectthe subject of an incomming email.
Returns:
if the ticket's id is succesfully parsed, it will return the ticket_id, else it returns 0.
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.

Parameters:
$mboxa mailbox object
$ithe email's id in the mailbox (integer)
$groupthe group object that owns the inbox.
Returns:
a string based on the found ticket i and timestamp (will be used to store a copy of the email locally)
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.

Returns:
return the child process id
new_message_id ( ticketId)

creates a new message id for a email about to send.

Parameters:
$ticketIdthe ticket id of the ticket that is mentioned in the email.
Returns:
returns a string, that consist out of some variable parts, a consistent part and the ticket_id. The ticket_id will be used lateron, if someone replies on the message, to see to which ticket the reply should be added.
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.

Parameters:
$recipientif 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.
$subjectthe subject of the email
$bodythe body of the email
$ticket_idthe id of the ticket
$fromthe 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.

Parameters:
$receiverif 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.
$ticketObjthe ticket object itself, this is being used for including ticket related information into the email.
$contentthe content of a reply or new ticket
$typeREPLY, 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.

Field Documentation

$db [private]

db object used by various methods.


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables