Mail sentence checker

A mail sentence checker! That's a great idea. Here's a simple implementation in Python:

import re

class MailSentenceChecker:
    def __init__(self):
        self.email_regex = re.compile(r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$")

    def check_email(self, sentence):
        words = sentence.split()
        for word in words:
            if self.email_regex.match(word):
                return True
        return False

# Example usage:
checker = MailSentenceChecker()
sentence = "Hello, my email is [email protected] and you can also reach me at [email protected]."
print(checker.check_email(sentence))  # Output: True

sentence = "Hello, my phone number is 123-456-7890."
print(checker.check_email(sentence))  # Output: False

This code defines a MailSentenceChecker class that uses a regular expression to match email addresses. The check_email method splits the input sentence into words and checks each word to see if it matches the email regex. If any word matches, the method returns True; otherwise, it returns False.

You can use this class to check if a sentence contains any valid email addresses. Note that this implementation is quite simple and may not catch all possible email address formats. For a more robust solution, you may want to use a dedicated email validation library.