Alternc
latest
Alternc logiel libre pour l'hébergement
|
This class handle emails (pop and/or aliases and even wrapper for internal classes) of hosted users. More...
Public Member Functions | |
m_mail () | |
Constructeur. More... | |
hook_menu () | |
Hook called by menu class to add the email menu to the left pane. More... | |
get_total_size_for_domain ($domain) | |
catchall_getinfos ($domain_id) | |
catchall_del ($domain_id) | |
catchall_set ($domain_id, $target) | |
hook_quota_get () | |
get_quota (hook for quota class), returns the number of used service for a quota-bound service More... | |
alternc_password_policy () | |
Password policy kind used in this class (hook for admin class) More... | |
enum_domains ($uid=-1) | |
Returns the list of mail-hosting domains for a user. More... | |
available ($mail) | |
available: tells if an email address can be installed in the server check the domain part (is it mine too), the syntax, and the availability. More... | |
enum_domain_mails ($dom_id=null, $search="", $offset=0, $count=30, $show_systemmails=false) | |
function used to list every mail address hosted on a domain. More... | |
hook_mail_get_details ($detail) | |
create ($dom_id, $mail, $type="", $dontcheck=false) | |
Function used to insert a new mail into the db should be used by the web interface, not by third-party programs. More... | |
get_details ($mail_id) | |
function used to get every information we can on a mail More... | |
is_it_my_mail ($mail_id) | |
Check if an email is mine ... More... | |
hook_dom_del_mx_domain ($dom_id) | |
Hook called when the DOMAIN class will delete a domain. More... | |
get_account_by_mail_id ($mail_id) | |
return the alternc account's ID of the mail_id More... | |
delete ($mail_id) | |
Function used to delete a mail from the db should be used by the web interface, not by third-party programs. More... | |
undelete ($mail_id) | |
Function used to undelete a pending deletion mail from the db should be used by the web interface, not by third-party programs. More... | |
set_passwd ($mail_id, $pass, $canbeempty=false) | |
set the password of an email address. More... | |
enable ($mail_id) | |
Enables an email address. More... | |
disable ($mail_id) | |
Disables an email address. More... | |
set_details ($mail_id, $islocal, $quotamb, $recipients, $delivery="dovecot", $dontcheck=false) | |
Function used to update an email settings should be used by the web interface, not by third-party programs. More... | |
add_wrapper ($dom_id, $m, $delivery) | |
A wrapper used by mailman class to create it's needed addresses @ param : $dom_id , the domain id associated to a given address @ param : $m , the left part of the mail address being created @ param : $delivery , the delivery used to deliver the mail. More... | |
create_alias ($dom_id, $m, $alias, $type="", $dontcheck=false) | |
A function used to create an alias for a specific address @ param : $dom_id , the domain sql identifier @ param : $m , the alias we want to create @ param : $alias , the already existing aliased address @ param : $type, the type of the alias created. More... | |
del_wrapper ($mail_id) | |
A wrapper used by mailman class to create it's needed addresses @ param : $mail_id , the mysql id of the mail address we want to delete of the email for the current acccount. More... | |
alternc_export_conf () | |
Export the mail information of an account. More... | |
enum_slave_account () | |
Return the list of allowed slave accounts (secondary-mx) More... | |
check_slave_account ($login, $pass) | |
Check for a slave account (secondary mx) More... | |
echo_domain_list ($format=null) | |
Out (echo) the complete hosted domain list : More... | |
add_slave_account ($login, $pass) | |
Add a slave account that will be allowed to access the mxdomain list. More... | |
del_slave_account ($login) | |
Remove a slave account. More... | |
hook_dom_add_slave_domain ($domain_id, $target_domain) | |
hook function called by AlternC when a domain is created for the current user account using the SLAVE DOMAIN feature This function create a CATCHALL to the master domain More... | |
hook_dom_add_mx_domain ($domain_id) | |
hook function called by AlternC when a domain is created for the current user account This function create a postmaster mail which is an alias to LOGIN @ FQDN wich is a dynamic alias to the alternc's account mail More... | |
hook_variable_set ($name, $old, $new) | |
hook function called by variables when a variable is changed @access private More... | |
set_dns_autoconf ($domain, $uid=-1) | |
Add dns entries for autodiscover / autoconf on the domain. More... | |
del_dns_autoconf ($domain) | |
delete the autoconf / autodiscover vhosts when removing a domain as MX More... | |
set_dns_spf ($domain, $spf, $previous=-1, $uid=-1, $login=-1) | |
Set or UPDATE the DNS record for the domain $dom(str) to be $spf account's login is current and if not it's $login. More... | |
del_dns_spf ($domain) | |
delete the SPF entries in the sub_domaine table for a domain called by del_domain or del_mx_domain by hooks : More... | |
set_dns_dmarc ($domain, $dmarc, $previous=-1, $uid=-1, $login=-1) | |
Set or UPDATE the DNS record for the domain $dom(str) to be $dmarc account's login is current and if not it's $login. More... | |
del_dns_dmarc ($domain) | |
delete the DMARC entries in the sub_domaine table for a domain called by del_domain or del_mx_domain by hooks : More... | |
hook_updatedomains_dns_pre () | |
Hook launched before doing anything dns-related. More... | |
hook_updatedomains_dns_post () | |
Hook launched after doing anything dns-related. More... | |
dkim_add ($domain, $uid) | |
Add a domain into OpenDKIM configuration. More... | |
dkim_del ($domain) | |
Delete a domain from OpenDKIM configuration. More... | |
dkim_get_entry ($domain) | |
return the content of the TXT information to be added into the DB for DKIM subdomains More... | |
Public Attributes | |
$domains | |
domain list for this account @access private More... | |
$specialchars = array('"', "'", '\\', '/') | |
If an email has those chars, 'not nice in shell env' ;) we don't store the email in $mail/u/{user}_domain, but in $mail/_/{address_id}_domain @access private. More... | |
$forbiddenchars = array('"', "'", '\\', '/', '?', '!', '*', '$', '|', '#', '+') | |
If an email has those chars, we will ONLY allow RECIPIENTS, NOT POP/IMAP for DOVECOT ! Since Dovecot doesn't allow those characters @access private. More... | |
$total | |
Number of results for a pager display @access public. More... | |
$srv_postfix | |
$srv_dovecot | |
$cache_domain_mail_size = array() | |
$enum_domains = array() | |
$shouldreloaddkim | |
Manage DKIM when adding / removing a domain MX management. More... | |
Private Attributes | |
$isitmy_cache = array() | |
This class handle emails (pop and/or aliases and even wrapper for internal classes) of hosted users.
This class is directly using the following alternc MySQL tables: address = any used email address will be defined here, mailbox = pop/imap mailboxes, recipient = redirection from an email to another and indirectly the domain class, to know domain names from their id in the DB. This class is also defining a few hooks, search ->invoke in the code.
Definition at line 32 of file m_mail.php.
m_mail::add_slave_account | ( | $login, | |
$pass | |||
) |
Add a slave account that will be allowed to access the mxdomain list.
string | $login | the login to add |
string | $pass | the password to add |
Definition at line 898 of file m_mail.php.
m_mail::add_wrapper | ( | $dom_id, | |
$m, | |||
$delivery | |||
) |
A wrapper used by mailman class to create it's needed addresses @ param : $dom_id , the domain id associated to a given address @ param : $m , the left part of the mail address being created @ param : $delivery , the delivery used to deliver the mail.
Definition at line 744 of file m_mail.php.
References set_details().
m_mail::alternc_export_conf | ( | ) |
Export the mail information of an account.
Definition at line 794 of file m_mail.php.
References enum_domain_mails(), and enum_domains().
m_mail::alternc_password_policy | ( | ) |
Password policy kind used in this class (hook for admin class)
Definition at line 209 of file m_mail.php.
m_mail::available | ( | ) |
available: tells if an email address can be installed in the server check the domain part (is it mine too), the syntax, and the availability.
string email to check |
Definition at line 254 of file m_mail.php.
m_mail::catchall_del | ( | $domain_id | ) |
string | $domain_id |
Definition at line 152 of file m_mail.php.
References catchall_getinfos().
Referenced by catchall_set().
m_mail::catchall_getinfos | ( | $domain_id | ) |
string | $domain_id |
Definition at line 121 of file m_mail.php.
Referenced by catchall_del().
m_mail::catchall_set | ( | $domain_id, | |
$target | |||
) |
string | $domain_id | |
string | $target |
Definition at line 165 of file m_mail.php.
References catchall_del(), and create_alias().
Referenced by hook_dom_add_slave_domain().
m_mail::check_slave_account | ( | $login, | |
$pass | |||
) |
Check for a slave account (secondary mx)
string | $login | the login to check |
string | $pass | the password to check |
Definition at line 854 of file m_mail.php.
m_mail::create | ( | $dom_id, | |
$mail, | |||
$type = "" , |
|||
$dontcheck = false |
|||
) |
Function used to insert a new mail into the db should be used by the web interface, not by third-party programs.
This function calls the hook "hooks_mail_cancreate" which must return FALSE if the user can't create this email, and raise and error accordingly
$dom_id | integer A domain_id (owned by the user) (will be the part at the right of the @ in the email) |
string the left part of the email to create (something@dom_id) |
Definition at line 350 of file m_mail.php.
m_mail::create_alias | ( | $dom_id, | |
$m, | |||
$alias, | |||
$type = "" , |
|||
$dontcheck = false |
|||
) |
A function used to create an alias for a specific address @ param : $dom_id , the domain sql identifier @ param : $m , the alias we want to create @ param : $alias , the already existing aliased address @ param : $type, the type of the alias created.
string | $m | |
string | $alias | |
string | $dom_id |
Definition at line 764 of file m_mail.php.
References set_details().
Referenced by catchall_set(), and hook_dom_add_mx_domain().
m_mail::del_dns_autoconf | ( | $domain | ) |
delete the autoconf / autodiscover vhosts when removing a domain as MX
Definition at line 1037 of file m_mail.php.
Referenced by hook_dom_del_mx_domain().
m_mail::del_dns_dmarc | ( | $domain | ) |
delete the DMARC entries in the sub_domaine table for a domain called by del_domain or del_mx_domain by hooks :
Definition at line 1125 of file m_mail.php.
Referenced by hook_dom_del_mx_domain().
m_mail::del_dns_spf | ( | $domain | ) |
delete the SPF entries in the sub_domaine table for a domain called by del_domain or del_mx_domain by hooks :
Definition at line 1079 of file m_mail.php.
Referenced by hook_dom_del_mx_domain().
m_mail::del_slave_account | ( | $login | ) |
Remove a slave account.
string | $login | the login to delete |
Definition at line 914 of file m_mail.php.
m_mail::del_wrapper | ( | $mail_id | ) |
A wrapper used by mailman class to create it's needed addresses @ param : $mail_id , the mysql id of the mail address we want to delete of the email for the current acccount.
Definition at line 782 of file m_mail.php.
m_mail::delete | ( | $mail_id | ) |
Function used to delete a mail from the db should be used by the web interface, not by third-party programs.
$mail_id | integer the number of the email to delete |
Definition at line 506 of file m_mail.php.
References get_details(), and is_it_my_mail().
m_mail::disable | ( | $mail_id | ) |
Disables an email address.
$mail_id | integer Email ID |
Definition at line 651 of file m_mail.php.
References is_it_my_mail().
m_mail::dkim_add | ( | $domain, | |
$uid | |||
) |
Add a domain into OpenDKIM configuration.
Definition at line 1178 of file m_mail.php.
References dkim_get_entry().
Referenced by hook_updatedomains_dns_pre().
m_mail::dkim_del | ( | $domain | ) |
Delete a domain from OpenDKIM configuration.
Definition at line 1215 of file m_mail.php.
Referenced by hook_dom_del_mx_domain(), and hook_updatedomains_dns_pre().
m_mail::dkim_get_entry | ( | $domain | ) |
return the content of the TXT information to be added into the DB for DKIM subdomains
$domain | string the name of the domain name |
Definition at line 1238 of file m_mail.php.
Referenced by dkim_add().
m_mail::echo_domain_list | ( | $format = null | ) |
m_mail::enable | ( | $mail_id | ) |
Enables an email address.
$mail_id | integer Email ID |
Definition at line 633 of file m_mail.php.
References is_it_my_mail().
m_mail::enum_domain_mails | ( | $dom_id = null , |
|
$search = "" , |
|||
$offset = 0 , |
|||
$count = 30 , |
|||
$show_systemmails = false |
|||
) |
function used to list every mail address hosted on a domain.
$dom_id | integer the domain id. |
$search | string search that string in recipients or address. |
$offset | integer skip THAT much emails in the result. |
$count | integer return no more than THAT much emails. -1 for ALL. Offset is ignored then. |
Definition at line 285 of file m_mail.php.
References $res.
Referenced by alternc_export_conf(), and hook_dom_del_mx_domain().
m_mail::enum_domains | ( | $uid = -1 | ) |
Returns the list of mail-hosting domains for a user.
Definition at line 218 of file m_mail.php.
References $enum_domains.
Referenced by alternc_export_conf(), and hook_menu().
m_mail::enum_slave_account | ( | ) |
Return the list of allowed slave accounts (secondary-mx)
Definition at line 834 of file m_mail.php.
References $res.
m_mail::get_account_by_mail_id | ( | $mail_id | ) |
return the alternc account's ID of the mail_id
Definition at line 488 of file m_mail.php.
m_mail::get_details | ( | $mail_id | ) |
function used to get every information we can on a mail
$mail_id | integer |
Definition at line 402 of file m_mail.php.
References is_it_my_mail().
Referenced by delete(), and set_details().
m_mail::get_total_size_for_domain | ( | $domain | ) |
Definition at line 102 of file m_mail.php.
m_mail::hook_dom_add_mx_domain | ( | $domain_id | ) |
hook function called by AlternC when a domain is created for the current user account This function create a postmaster mail which is an alias to LOGIN @ FQDN wich is a dynamic alias to the alternc's account mail
string | $domain_id | Domain that has just been created @access private |
Definition at line 947 of file m_mail.php.
References create_alias(), set_dns_autoconf(), set_dns_dmarc(), and set_dns_spf().
m_mail::hook_dom_add_slave_domain | ( | $domain_id, | |
$target_domain | |||
) |
hook function called by AlternC when a domain is created for the current user account using the SLAVE DOMAIN feature This function create a CATCHALL to the master domain
string | $domain_id | Domain that has just been created |
string | $target_domain | Master domain @access private |
Definition at line 930 of file m_mail.php.
References catchall_set().
m_mail::hook_dom_del_mx_domain | ( | $dom_id | ) |
Hook called when the DOMAIN class will delete a domain.
OR when the DOMAIN class tells us we don't host the emails of this domain anymore.
$dom | the ID of the domain to delete |
Definition at line 460 of file m_mail.php.
References del_dns_autoconf(), del_dns_dmarc(), del_dns_spf(), dkim_del(), and enum_domain_mails().
m_mail::hook_mail_get_details | ( | $detail | ) |
Definition at line 330 of file m_mail.php.
m_mail::hook_menu | ( | ) |
Hook called by menu class to add the email menu to the left pane.
Definition at line 83 of file m_mail.php.
References enum_domains().
m_mail::hook_quota_get | ( | ) |
get_quota (hook for quota class), returns the number of used service for a quota-bound service
$name | string the named quota we want |
Definition at line 192 of file m_mail.php.
m_mail::hook_updatedomains_dns_post | ( | ) |
Hook launched after doing anything dns-related.
Definition at line 1166 of file m_mail.php.
m_mail::hook_updatedomains_dns_pre | ( | ) |
Hook launched before doing anything dns-related.
Definition at line 1139 of file m_mail.php.
References dkim_add(), and dkim_del().
m_mail::hook_variable_set | ( | $name, | |
$old, | |||
$new | |||
) |
hook function called by variables when a variable is changed @access private
Definition at line 979 of file m_mail.php.
References $res, set_dns_dmarc(), and set_dns_spf().
m_mail::is_it_my_mail | ( | $mail_id | ) |
Check if an email is mine ...
$mail_id | integer the number of the email to check |
Definition at line 436 of file m_mail.php.
Referenced by delete(), disable(), enable(), get_details(), set_passwd(), and undelete().
m_mail::m_mail | ( | ) |
Constructeur.
Definition at line 73 of file m_mail.php.
m_mail::set_details | ( | $mail_id, | |
$islocal, | |||
$quotamb, | |||
$recipients, | |||
$delivery = "dovecot" , |
|||
$dontcheck = false |
|||
) |
Function used to update an email settings should be used by the web interface, not by third-party programs.
$mail_id | integer the number of the email to delete | |
integer | $islocal | boolean is it a POP/IMAP mailbox ? |
integer | $quotamb | integer if islocal=1, quota in MB |
string | $recipients | string recipients, one mail per line. |
Definition at line 675 of file m_mail.php.
References get_details().
Referenced by add_wrapper(), and create_alias().
m_mail::set_dns_autoconf | ( | $domain, | |
$uid = -1 |
|||
) |
Add dns entries for autodiscover / autoconf on the domain.
Definition at line 1011 of file m_mail.php.
Referenced by hook_dom_add_mx_domain().
m_mail::set_dns_dmarc | ( | $domain, | |
$dmarc, | |||
$previous = -1 , |
|||
$uid = -1 , |
|||
$login = -1 |
|||
) |
Set or UPDATE the DNS record for the domain $dom(str) to be $dmarc account's login is current and if not it's $login.
don't change dmarc if current value is not $old @access private
Definition at line 1092 of file m_mail.php.
Referenced by hook_dom_add_mx_domain(), and hook_variable_set().
m_mail::set_dns_spf | ( | $domain, | |
$spf, | |||
$previous = -1 , |
|||
$uid = -1 , |
|||
$login = -1 |
|||
) |
Set or UPDATE the DNS record for the domain $dom(str) to be $spf account's login is current and if not it's $login.
don't change spf if current value is not $old @access private
Definition at line 1050 of file m_mail.php.
Referenced by hook_dom_add_mx_domain(), and hook_variable_set().
m_mail::set_passwd | ( | $mail_id, | |
$pass, | |||
$canbeempty = false |
|||
) |
set the password of an email address.
$mail_id | integer email ID |
$pass | string the new password. |
Definition at line 607 of file m_mail.php.
References is_it_my_mail().
m_mail::undelete | ( | $mail_id | ) |
Function used to undelete a pending deletion mail from the db should be used by the web interface, not by third-party programs.
$mail_id | integer the email id |
Definition at line 558 of file m_mail.php.
References is_it_my_mail().
m_mail::$cache_domain_mail_size = array() |
Definition at line 66 of file m_mail.php.
m_mail::$domains |
domain list for this account @access private
Definition at line 38 of file m_mail.php.
m_mail::$enum_domains = array() |
Definition at line 67 of file m_mail.php.
Referenced by enum_domains().
m_mail::$forbiddenchars = array('"', "'", '\\', '/', '?', '!', '*', '$', '|', '#', '+') |
If an email has those chars, we will ONLY allow RECIPIENTS, NOT POP/IMAP for DOVECOT ! Since Dovecot doesn't allow those characters @access private.
Definition at line 54 of file m_mail.php.
|
private |
Definition at line 426 of file m_mail.php.
m_mail::$shouldreloaddkim |
Manage DKIM when adding / removing a domain MX management.
Definition at line 1132 of file m_mail.php.
m_mail::$specialchars = array('"', "'", '\\', '/') |
If an email has those chars, 'not nice in shell env' ;) we don't store the email in $mail/u/{user}_domain, but in $mail/_/{address_id}_domain @access private.
Definition at line 46 of file m_mail.php.
m_mail::$srv_dovecot |
Definition at line 65 of file m_mail.php.
m_mail::$srv_postfix |
Definition at line 64 of file m_mail.php.
m_mail::$total |
Number of results for a pager display @access public.
Definition at line 61 of file m_mail.php.