summaryrefslogtreecommitdiff
path: root/src/checker/errors/mail/at_sign.cpp
blob: 0acb47039f40cdaa203e93d411c549af50973fa3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <regex>

#include "at_sign.hpp"
#include "logger/logger_set.hpp"

namespace smtp::checker::errors::mail
{
    bool AtSign::Check( std::string const& line ) const
    {
        std::string mask = R"([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4}))";

        auto result = std::regex_search( line, std::regex{mask} );
        if( !result )
        {
            logger::LoggerSet::GetInstance()->LogError( GetMethodName(), "Error in mail note" );
        }
        return result;
    }
}