Filippo
Member
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:
and looking at triggerUserBounceAction:
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.
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.