• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 New members with hard bounced email

#1
Hello, I tried searching for a while, sorry if this is already stated somewhere.

When a new member registers with an invalid email, I can correctly see the the hard bounce in the logs. However, the state of his account is not changed to "Email invalid (bounced)", instead it stays on "Awaiting for email confirmation". The user doesn't see the error message about their mail being invalid, they just see the post-registration message.

I found this method in the code:
PHP:
public function takeBounceAction($userId, $bounceType, $bounceDate)

    {
        if (!$userId)
        {
            return '';
        }

        if ($bounceType == 'hard')
        {
            $this->triggerUserBounceAction($userId);

            return 'hard';
        }
        else if ($bounceType == 'soft')
        {
            $this->_getDb()->query("
                INSERT INTO xf_email_bounce_soft
                    (user_id, bounce_date, bounce_total)
                VALUES
                    (?, ?, 1)
                ON DUPLICATE KEY UPDATE
                    bounce_total = bounce_total + 1
            ", array($userId, gmdate('Y-m-d', $bounceDate)));

            if ($this->hasSoftBouncedTooMuch($userId))
            {
                $this->triggerUserBounceAction($userId);

                return 'soft_hard';
            }

            return 'soft';
        }

        return '';
    }

and looking at triggerUserBounceAction:
PHP:
public function triggerUserBounceAction($userId)

    {
        $user = XenForo_DataWriter::create('XenForo_DataWriter_User', XenForo_DataWriter::ERROR_SILENT);
        if ($user->setExistingData($userId))
        {
            if ($user->get('user_state') == 'valid'
                && !$user->get('is_moderator')
                && !$user->get('is_admin')
                && !$user->get('is_staff')
            )
            {
                $user->set('user_state', 'email_bounce');
                $user->save();
            }
        }
    }

I found the cause of the problem: it sets the user state to email_bounce only if it's currently valid. Why does this happen? Shouldn't it set the state to email_bounce even if the previous state is not valid?

Thanks in advance.
 

Pierce

Well-known member
#2
It shows the user that their account is invalid an does not send any more emails unless the user requested another one. It shows the email entered so the user is confirming that's their email.

On the other hand if you are valid and subscribe with email the system will mark your email as "bounced" to stop sending email so you don't get marked as spam.

So I guess there's no reason to mark it as bounced?
 
#3
Surely the system should mark it as a hard bounce as that status should take priority over not confirmed? A hard bounced email is not going to suddenly start working so the user should be told that they need to change to a working email address.
 
#4
It shows the user that their account is invalid an does not send any more emails unless the user requested another one. It shows the email entered so the user is confirming that's their email.

On the other hand if you are valid and subscribe with email the system will mark your email as "bounced" to stop sending email so you don't get marked as spam.

So I guess there's no reason to mark it as bounced?
It doesn't show that the account is invalid, it just tells the user to confirm the email. They sometimes make a typo in the email, and they probably don't spot it unless you tell them that their email is invalid.

Surely the system should mark it as a hard bounce as that status should take priority over not confirmed? A hard bounced email is not going to suddenly start working so the user should be told that they need to change to a working email address.
Yes, it should work like that, but for some reason it doesn't.