ispCP - Board - Support
see mail-forward in overview - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Contributions Area (/forum-40.html)
+--- Forum: Snippets (/forum-42.html)
+--- Thread: see mail-forward in overview (/thread-4723.html)



see mail-forward in overview - joximu - 10-17-2008 11:47 PM

I want to see in the mail overview where mails are forwarded...

This will do it:

in mail_accounts.php, I did it for the normal-mails...:

Code:
function gen_page_dmn_mail_list(&$tpl, &$sql, $dmn_id, $dmn_name) {
# old line after SELECT:
#            `mail_id`, `mail_acc`, `mail_type`, `status`, `mail_auto_respond`
# how many chars of the forward-list?
$forwLen = 50;
        $dmn_query ="
                SELECT
            `mail_id`, `mail_acc`, `mail_type`, `status`, `mail_auto_respond`, CONCAT( LEFT(`mail_forward`, $forwLen), IF( LENGTH(`mail_forward`) > $forwLen, '...', '') ) as 'mail_forward'
                FROM
            `mail_users`
                WHERE
            `domain_id` = ?
                AND
            `sub_id` = 0
                AND
            (`mail_type` LIKE '%normal_mail%' OR `mail_type` LIKE '%normal_forward%')
                ORDER BY
            `mail_acc` ASC,
            `mail_type` DESC
        ";

        $rs = exec_query($sql, $dmn_query, array($dmn_id));
        if ($rs->RecordCount() == 0) {
                return 0;
        } else {
                global $counter;
                while (!$rs->EOF) {
                        if ($counter % 2 == 0) {
                                $tpl->assign('ITEM_CLASS', 'content');
                        } else {
                                $tpl->assign('ITEM_CLASS', 'content2');
                        }

                        list($mail_action, $mail_action_script, $mail_edit_script) = gen_user_mail_action($rs->fields['mail_id'], $rs->fields['status']);

                        $mail_acc = decode_idna($rs->fields['mail_acc']);
                        $show_dmn_name = decode_idna($dmn_name);

                        $mail_types = explode(',', $rs->fields['mail_type']);
                        $mail_type = '';

                        foreach ($mail_types as $type) {
# old line, replaced with 3 lines
#                              $mail_type .= user_trans_mail_type($type) . "<br />";
                                $mail_type .= user_trans_mail_type($type);
                                if (strpos($type, '_forward') !== false) $mail_type .= ': '.$rs->fields['mail_forward'];
                                $mail_type .= '<br />';
                        }

if forwLen is not to big then "..." will be added if the list of forwarding addresses is longer...

What do you think?

maybe integrate into the trunk - in all 3 parts (also sub and alias)

/Joximu


RE: see mail-forward in overview - FeG - 10-18-2008 10:39 PM

Hi joximu,

thanks for this idea, I think that's a very nice feature and so I've created a ticket for this and uploaded the appropriate patch.

I've therefor modified your code in 2 aspects:

1) I've hardcoded the string length of 50, after which the string is cut, since I didn't want to redefine this variable in each function.

2) I've added a str_replace so that multiple recipients are separated with ', '.

Greetings
FeG


RE: see mail-forward in overview - sci2tech - 10-19-2008 12:28 AM

Since I`m working on mail this part how about autorespond for alias? Shall this be implemented? Anyway still to come is mail for alias subdomains Wink