vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Administrative and Maintenance Tools - [DBTech] vBMail v2 (vB4) (https://vborg.vbsupport.ru/showthread.php?t=266142)

CharlieDelta 09-25-2011 11:17 PM

Fixed. :D

Logician 11-11-2011 08:55 AM

Firstly thanks for the great hack. It is well written, has a clean code and from checking the source code, I can confirm that a lot of work is put into the project so frankly speaking I believe it is not appreciated enough. So I wanted to tell my appreciation for your work first! :-)

I installed it in a friend's board. He wants to use for bounce email management and not interested in email listing features so my comments are regarding this part only. During installation I had some issues, glitches and fixes for them so I wanted to share with you considering you might want to know about them.

ISSUE 1:

During the initial installation the hack didn't work first. It gave no signal but it was not processing any bounced emails. After some debugging, I noticed that imap_open() was failing with error:
Warning: imap_open() [function.imap-open]: Couldn't open stream {mail.___.com:143/imap}Inbox in [path]/dbtech/vbmail/includes/class_imap.php on line 98
Although all login details were correct.

After some work I noticed our server is requiring /novalidate-cert parameter otherwise, it is dieing with error:
Certificate failure for
___.com: self signed certificate:
/C=US/ST=Unknown/L=Unknown/O=Unknown/OU=Unknown/CN=server1.____/emailAddress=ssl@server1.___"

So changing the line in dbtech/vbmail/includes/class_imap.php:
PHP Code:

self::$connection imap_open(
                
'{' self::$vbulletin->options['dbtech_vbmail_imap_host'] . ':' self::$vbulletin->options['dbtech_vbmail_imap_port'] . '/imap' 
                    (
self::$vbulletin->options['dbtech_vbmail_imap_ssl'] ? '/ssl/novalidate-cert' '') . 
                    (
self::$vbulletin->options['dbtech_vbmail_imap_tls'] ? '/tls/novalidate-cert' '') . 
                
'}' self::$vbulletin->options['dbtech_vbmail_imap_mailbox'],
                
self::$vbulletin->options['dbtech_vbmail_imap_username'],
                
self::$vbulletin->options['dbtech_vbmail_imap_password']
            ); 

as
PHP Code:

            //Logician Hack : Added /novalidate-cert as mail server is rejecting connection without this
            
self::$connection imap_open(
                
'{' self::$vbulletin->options['dbtech_vbmail_imap_host'] . ':' self::$vbulletin->options['dbtech_vbmail_imap_port'] . '/novalidate-cert/imap' 
                    (
self::$vbulletin->options['dbtech_vbmail_imap_ssl'] ? '/ssl/novalidate-cert' '') . 
                    (
self::$vbulletin->options['dbtech_vbmail_imap_tls'] ? '/tls/novalidate-cert' '') . 
                
'}' self::$vbulletin->options['dbtech_vbmail_imap_mailbox'],
                
self::$vbulletin->options['dbtech_vbmail_imap_username'],
                
self::$vbulletin->options['dbtech_vbmail_imap_password']
            );
            
//Logician Hack : Added /novalidate-cert as mail server is rejecting connection without this 

fixed this issue for us.

I think it might be a good idea to:
1- Add a hack setting to enter custom parameters there. Alternatively you can make "IMAP Port" setting inputbox "string", instead of "number" which will then allow entering values like: 143/novalidate-cert
2- In part:
PHP Code:

if (!self::$connection)
            {
                
// We couldn't open the mailbox
                
trigger_error($vbphrase['dbtech_vbmail_cannot_open_mailbox'], E_USER_ERROR);
            } 

It might be helpful to vbmail() admin with the value of imap_last_error() variable as it will help debugging connection problems when hack can't connect to the mail server. ATM admin is in dark when a connection problem occurs as no error etc. are returned. (Even when scheduled task is run manually in admin cp)

ISSUE 2:

In dbtech /vbmail/cron/threshold.php, this part:
PHP Code:

$users $vbulletin->db->query_read_slave("
    SELECT
        user.userid,
        user.username,
        user.usergroupid,
        user.membergroupids,
        user.infractiongroupid,
        user.displaygroupid" 
. ($vbulletin->products['dbtech_vbshop'] ? ", user.dbtech_vbshop_purchase" '') . "
    FROM `" 
TABLE_PREFIX "dbtech_vbmail_message` AS dbtech_vbmail_message
    INNER JOIN " 
TABLE_PREFIX "user AS user ON(user.email = dbtech_vbmail_message.fromaddress)
    WHERE dbtech_vbmail_message.fromaddress != ''
        AND dbtech_vbmail_message.bounce = '1'
        AND user.dbtech_vbmail_bounceflag = '0'
    GROUP BY dbtech_vbmail_message.fromaddress
    HAVING COUNT(*) >= " 
intval($vbulletin->options['dbtech_vbmail_bounce_threshold'])
); 

Should be replaced as:
PHP Code:

$users $vbulletin->db->query_read_slave("
    SELECT
        user.userid,
        user.username,
        user.email,
        user.usergroupid,
        user.membergroupids,
        user.infractiongroupid,
        user.displaygroupid" 
. ($vbulletin->products['dbtech_vbshop'] ? ", user.dbtech_vbshop_purchase" '') . "
    FROM `" 
TABLE_PREFIX "dbtech_vbmail_message` AS dbtech_vbmail_message
    INNER JOIN " 
TABLE_PREFIX "user AS user ON(user.email = dbtech_vbmail_message.fromaddress)
    WHERE dbtech_vbmail_message.fromaddress != ''
        AND dbtech_vbmail_message.bounce = '1'
        AND user.dbtech_vbmail_bounceflag = '0'
    GROUP BY dbtech_vbmail_message.fromaddress
    HAVING COUNT(*) >= " 
intval($vbulletin->options['dbtech_vbmail_bounce_threshold'])
); 

Otherwise email part in the user pm is blank.

ISSUE 3:

The hack is not unflagging user if vb option "verifyemail" is turned off since you tied unflagging only to register.php user activation screen. I added this pluggin to correct this issue for boards which does not use email confirmation:

HOOK LOCATION: profile_updatepassword_complete
PHP CODE:
Quote:

//Logician Hack : If user is not banned AND changed his email correctly AND email verification is OFF, THEN unflag dbtech_vbmail_bounceflag setting
if ($permissions['genericoptions'] & $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] AND ($vbulletin->GPC['email'] != $vbulletin->userinfo['email'] AND $vbulletin->GPC['email'] AND $vbulletin->GPC['emailconfirm'] == $vbulletin->GPC['email']) AND !$vbulletin->options['verifyemail'])
{

$onoff = '0';
$userdata->set('dbtech_vbmail_bounceflag', $onoff);
}
This fixed the issue for such boards.

If I run into other issues, I'll keep reporting.

And once again, thanks for the great hack and efforts put into it! ;)

DragonByte Tech 11-11-2011 10:04 AM

Quote:

Originally Posted by Logician (Post 2266874)
Firstly thanks for the great hack. It is well written, has a clean code and from checking the source code, I can confirm that a lot of work is put into the project so frankly speaking I believe it is not appreciated enough. So I wanted to tell my appreciation for your work first! :-)

Thank you! You're actually the first person (outside the DBTech team :p) that's complimented me on my code quality, so it really means a lot :D

Quote:

Originally Posted by Logician (Post 2266874)
ISSUE 1:

[...]

I think it might be a good idea to:
1- Add a hack setting to enter custom parameters there. Alternatively you can make "IMAP Port" setting inputbox "string", instead of "number" which will then allow entering values like: 143/novalidate-cert

I presume there's no downside to adding novalidate-cert for everyone? Surely no servers can be set up to hard reject a connection that tries to skip certificate validation as opposed to simply ignoring that directive... Thinking out loud here. I'd prefer to have it working without requiring admins to edit the port like that :)

I've added the novalidate-cert and the imap_last_error() to the file and it'll be updated with the next version :)

Quote:

Originally Posted by Logician (Post 2266874)
ISSUE 2:

In dbtech /vbmail/cron/threshold.php, this part:
[...]

Otherwise email part in the user pm is blank.

Whoops xD

Quote:

Originally Posted by Logician (Post 2266874)
ISSUE 3:

The hack is not unflagging user if vb option "verifyemail" is turned off since you tied unflagging only to register.php user activation screen.

And this is the kicker that requires a new version number as opposed to a hotfix xD

I'll release it later tonight alongside a vBActivity & Awards update, thanks :D


Fillip

Logician 11-14-2011 09:37 AM

I've been reported that sometimes this error shows up for admin:
PHP Code:

Fatal error:  Class 'VBMAIL' not found in /home/..../public_html/forum/dbtech/vbmail/hooks/mail_send.php on line 10 

I traced it a little and noticed it could only happen during vb cron mailing. You include the class in "global_bootstrap_init_complete" hook so it should be there in all page visits but there must be a vb section which triggers vb mail cron for admin visitor without initializing "global_bootstrap_init_complete" hook to produce this error. I'm still working on it to find where but wanted to report here in case you also have an idea. :)

DragonByte Tech 11-14-2011 02:17 PM

My guess is that the Cron doesn't use vB's bootstrap to initialise. Since cron mailing don't need vBMail stuff anyway, I'll edit the mail_send hook with this
PHP Code:

    if (class_exists('VBMAIL') AND VBMAIL::$pluginglobals['mailinglist']) 

That should work :)


Fillip

Logician 11-14-2011 02:47 PM

Quote:

Originally Posted by DragonByte Tech (Post 2267845)
My guess is that the Cron doesn't use vB's bootstrap to initialise. Since cron mailing don't need vBMail stuff anyway, I'll edit the mail_send hook with this
PHP Code:

    if (class_exists('VBMAIL') AND VBMAIL::$pluginglobals['mailinglist']) 

That should work :)

Why doesn't cron mailing need vbmail stuff? Daily/weekly digest, birthday greetings, event reminder are performed via cron. Actually so is ALL mailing process if "Use Mailqueue System" setting is turned on in vb. Am I missing something? :)

DragonByte Tech 11-14-2011 02:54 PM

Because bounced mail collection is not strictly dependent on anything in that hook, the headers simply help it identify the source :)

Not to mention anything within that if condition I posted is only supposed to happen on vBMail's own pages anyway :)


Fillip

Logician 11-14-2011 03:05 PM

Quote:

Originally Posted by DragonByte Tech (Post 2267859)
Because bounced mail collection is not strictly dependent on anything in that hook, the headers simply help it identify the source :)

Not to mention anything within that if condition I posted is only supposed to happen on vBMail's own pages anyway :)

Yes collecting is not needing that hook but I assumed email sending depended on that since it needs to check if bounce flag is for the TO: user on. But I guess I'm safe to assume this class is not needed during that process, right? :)

DragonByte Tech 11-14-2011 03:33 PM

Correct :)


Fillip

Logician 11-14-2011 05:56 PM

ok thanks! :)

And one more issue I pulled from PHP error log: When threshold.php runs on cron, it is producing "PHP Fatal error: Call to undefined function print_cp_message() in /home/.../public_html/forum/includes/class_dm.php on line 1092"

When I run the cron in scheduled tasks, it does not produce the error so I believe it only happens when it runs on its own.


All times are GMT. The time now is 01:36 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01386 seconds
  • Memory Usage 1,816KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete