Inbound Email - No Auto-Reply to this Domain issue

Hi All,

In SugarCRM this used to work before doing a Migration over to SuiteCRM. Fixed a few things with the help of the community here however the “No Auto-Reply to this Domain: none” no longer works. I have tested with one domain vs multiple comma seperated which do not work.

i.e domain.com or domain1.com,domain2.com.

Yes SugarCRM we had to do the whole root domain due to many different people at the same domains.

Doesn’t matter if i turn on debugging or not I cannot see where to look why it’s failing?

If anyone can steer me where to look that would be awesome.

I can see in the DB lot’s of referencing to emails / emails_* related.

Version 7.10.7

Sugar Version 6.5.25 (Build 344)

I’m pretty sure this is handled in InboundEmail.php, Please see function below, have I found the right area? Can someone help me debug whether $filterDomain contacts anything? From the debug below it seems in the log I can tail for Autoreply but the log isn’t showing any of this even though I have debug level activated.


public function checkFilterDomain($email)
    {
        $filterDomain = $this->get_stored_options('filter_domain');
        if (!isset($filterDomain) || empty($filterDomain)) {
            return true; // nothing set for this
        } else {
            $replyTo = strtolower($email->reply_to_email);
            $from = strtolower($email->from_addr);
            $filterDomain = '@' . strtolower($filterDomain);
            if (strpos($replyTo, $filterDomain) !== false) {
                $GLOBALS['log']->debug('Autoreply cancelled - [reply to] address domain matches filter domain.');

                return false;
            } elseif (strpos($from, $filterDomain) !== false) {
                $GLOBALS['log']->debug('Autoreply cancelled - [from] address domain matches filter domain.');

                return false;
            } else {
                return true; // no match
            }
        }
    }

I found this in the git version: My only guess to why the change is because the } else { clause was causing a false positive???


public function checkFilterDomain($email)
    {
        $filterDomain = $this->get_stored_options('filter_domain');
        if (!isset($filterDomain) || empty($filterDomain)) {
            return true; // nothing set for this
        }
        $replyTo = strtolower($email->reply_to_email);
        $from = strtolower($email->from_addr);
        $filterDomain = '@' . strtolower($filterDomain);
        if (strpos($replyTo, $filterDomain) !== false) {
            $GLOBALS['log']->debug('Autoreply cancelled - [reply to] address domain matches filter domain.');
            return false;
        } elseif (strpos($from, $filterDomain) !== false) {
            $GLOBALS['log']->debug('Autoreply cancelled - [from] address domain matches filter domain.');
            return false;
        }
        return true; // no match
    }

still no good, not having much luck here :confused: I think it’s not storing the domain list I add and save through the EditView page.

If you can, try doing a proper debug with XDEBUG and an IDE.

If you need to do debugging just from the log, start with an entry right at the top of the function, so you can make sure it is being called, and try a print_r or vardump of the filter_domain array to see if has the correct list to match.

If you need to check the list itself (if it is getting saved correctly), check in the database the table “inbound_email”, column “stored_options”.

Run that value through a Base64 decoder to see what’s in there: https://www.base64decode.org/

Yeah i compared a fresh LTS install vs our install and it is storing the filter_domain etc. Thank you pgr for assisting you always seem to know where something is or how it’s meant to work.will be hard to debug live version as its 15gb in size. will have to try and understand the inbound email php code etc.