Forums  ›  Cheetah  ›  Bug Reports
 

Blank emails; but not all emails

I will work on some code. I'll create a outbound mail logging feature to add to the tools section in admin. Could be a useful debugging feature anyway.

I don't see anything.  Can I put a check in to see what called the email function?  Do a check on if the subject is blank.  I don't see anything that is causing this.

No duplicates there. So yea, next would be to look into any modules you have that might be sending emails on join.

I need to look at what plugins I have installed.  I have also been testing third party plugins on Cheetah.  I need to check the handlers.  Thanks Deano.

 

I am wondering if you have duplicate alerts in your database. Could you run the following query.

SELECT * FROM `sys_alerts` WHERE `unit` = 'Profile' AND `action` = 'join'

You should get 3 items listed each with a different handler_id

 Here are the results.

 

On a fresh install of Cheetah B3 i have not been able to reproduce the issue.

Emails sent to the member on join are sent when the account is created in ChWsbProfilesController

Which email is sent depends on the moderation settings.

The emails that are sent to the admin occur when the join alert is created and is handled by the alerts system.

I am wondering if you have duplicate alerts in your database. Could you run the following query.

SELECT * FROM `sys_alerts` WHERE `unit` = 'Profile' AND `action` = 'join'

You should get 3 items listed each with a different handler_id

Duplicates should not occur anyway due to the unique indexes which should prevent that. But i can't find any other explanation for it.

I tested this against a Dolphin install of 7.4.2 and the new member joined and user confirmed email.  It is working on the Dolphin site.  I don't think this is an issue with the mail server but the Cheetah email script.

I need to put some test code in place but I am wondering if it is sending out two emails for each; New Member Joined and User Confirmed Email, one that has the fields filled in and then right behind it, another email that has the fields blank.  What do you think Deano?  Checking the time stamp in the headers of the two emails they have the same time stamp down to the seconds.  I might set up a second Cheetah site and see if it sends out blank emails as well when someone joins.  On the member joining side of things; the new member only gets one email asking for confirmation.  I did see the member get two notices about the membership being changed to promotion.  The second one was two minutes later and may be tied to the user clicking on continue.  That isn't much of a concern but the blank emails are.

What is the flow when a member joins and the emails are sent?

Has anyone set up a Cheetah B3 site and checked the member joining?

 

What do you have in your utils.inc.php at line 1017.


Also, one last question. Do you have any anti spam options turned on?

I have left things at the default.

Send report to admin if spam content discovered is on; everything else is off. 

1017 is the return for the function:

function ch_is_ip_whitelisted($sCurIP = '')

and is:

return db_value("SELECT `ID` FROM `sys_ip_list` WHERE `Type` = 'allow' AND `LastDT` > $iCurrTume AND `From` <= '$iCurIP' AND `To` >= '$iCurIP' LIMIT 1") ? true : false;

 

Could you tell me how your moderation settings are currently set.

 

Moderation.png38.5K30 views

And line 1017:utils.inc.php that is showing up in your blank emails does not make any sense to me either.

What do you have in your utils.inc.php at line 1017.


Also, one last question. Do you have any anti spam options turned on?

No clue. I do not have that issue. I will need to run some tests. Could you tell me how your moderation settings are currently set. It may have something to do with a specific combination of those settings. Or maybe not, just guessing at this point. But what are sent for emails when a user joins are determined by those settings.

The blank emails continue.  I don't have the logging in place since the upgrapdes removed the code.  However, I have found out what is triggering the blank emails.  The blank emails show up when a person joins the site.  I get a blank email, then an email that new member joined, then another blank email, then an email that user confirmed email.  I haven't seen any other blank emails related to any other function on the site.  This was basically a fresh install of Cheetah B3 and then importing the database.

The blank emails have:

Subject: =?UTF-8?B??=
X-PHP-Originating-Script: 1017:utils.inc.php
Content-type: text/html; charset=UTF-8
MIME-Version: 1.0

When I get time, I will try doing a completely fresh install of Cheetah with a fresh database install and see if it is there as well.  Meanwhile, any insight on where to look for this issue will be appreciated.

Thanks Deano for going to the trouble to create this code.  It is strange because there are emails that are being sent normally so it isn't related to a common issue.

On email servers; I have found that if you follow all the rules, DKIM, rDNS, SPF, etc then it greatly reduces being blocked by mail servers.

 

If you do a search on the boonex forums for =?UTF-8?B?? you will find this was a common issue a while back

 Yes, it was mainly related to the return newline \r\n.  I tried removing the return but that did not make a difference.

Ok. Put the following code changes on your site to log email sends from the site. It should at least tell you what page the email was sent from and show if any of the message fields were empty.

Open inc/header.inc.php

Look for this line.

$site['emailError'] = true;

Add this just under it.

$site['emailLog'] = true;
$site['emailLogPrivacy'] = false;

Save that. Then open inc/utils.inc.php

Look for this line in the function sendMail at about line 486

$sEmailNotify = isset($GLOBALS['site']['email_notify']) ? $GLOBALS['site']['email_notify'] : getParam('site_email_notify');

Insert this just ABOVE that line.

// Deano Start - Email  log modification.
    if($site['emailLog']) {
        $sLogDate = date("F j, Y, g:i a");
        $sHttpRefererLog = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'Empty';
        $sMailSubjectLog = ($sMailSubject == '' ? 'Empty' : $sMailSubject);
        if($site['emailLogPrivacy']) {
            $sRecipientEmailLog = ($sRecipientEmail == '' ? 'Empty' : 'Redacted for privacy. It was set and length was ' . strlen($sRecipientEmail));
            $sMailBodyLog = ($sMailBody == '' ? 'Empty' : 'Redacted for privacy. It was set and length was ' . strlen($sMailBody));
            $iRecipientIDLog = ($iRecipientID <= 0 ? $iRecipientID : 'Redacted for privacy. It was set and was greater then 0');
        } else {
            $sRecipientEmailLog = ($sRecipientEmail == '' ? 'Empty' : $sRecipientEmail);
            $sMailBodyLog = ($sMailBody == '' ? 'Empty' : $sMailBody);
            $iRecipientIDLog = $iRecipientID;
        }
        $aPlusLog = print_r($aPlus, true);
        if($site['emailLogPrivacy']) {
            $sPattern = "/[^@\s]*@[^@\s]*\.[^@\s]*/";
            $sReplacement = "[email address redacted]";
            $aPlusLog = preg_replace($sPattern, $sReplacement, $aPlusLog);
        }
        $sEmailFlagLog = $sEmailFlag;
        $isDisableAlertLog = ($isDisableAlert == true ? 'True' : 'False');
        $bForceSendLog = ($bForceSend == true ? 'True' : 'False');

        $sLog = <<<CODE
============= Start of sendmail log entry. {$sLogDate} =============
HTTP Referer: {$sHttpRefererLog}
Recipient Email Address: {$sRecipientEmailLog}
Subject: {$sMailSubjectLog}
Body: {$sMailBodyLog}
Recipient ID: {$iRecipientIDLog}
Content of aPlus array: {$aPlusLog}
Email flag: {$sEmailFlagLog}
Alert disabled: {$isDisableAlertLog}
Force send: {$bForceSendLog}
============== End of sendmail log entry. {$sLogDate} ==============


CODE;
        file_put_contents(CH_DIRECTORY_PATH_TMP . 'email_log.txt', $sLog, FILE_APPEND);
    }
// Deano End - Email  log modification.


That should start logging outgoing email and put it in email_log.txt in the site tmp folder.

I have found over 100 locations where cheetah sends mail. I will start with simpler logging for now and take it further if i have to.

I was also thinking that spammers or bots of some kind may be hitting the Contact Us form. I would try removing contact.php for now to see if the issue goes away.

I will work on some code modifications to create a log of every email sent out by cheetah. I will also add code to insert a tag into the header to mark what area of cheetah sent the message.

If you do a search on the boonex forums for =?UTF-8?B?? you will find this was a common issue a while back.


I dont think it happens when the smtp mailer is used. It's all i use because i don't use my own email server for outbound. I go through the sendinblue SMTP mail service. Much fewer emails are marked as spam that way, and my own servers ip won't get blocked.

 

There are a lot of areas where emails get generated, this may take awhile.

 

I am getting some blank emails on my site but not all emails are blank.  Looking at the source view of the email the subject line is Subject: =?UTF-8?B??= so it is reaching that part of the mail script. I don't see anything wrong with the templates.

I need some help on where I can set some traps to catch what is going wrong; which email template is being called, or anything that might can shed some light on this.

Forums  ›  Cheetah  ›  Bug Reports