Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / TargetCRM is CRM software company that sends emails to users every week

TargetCRM is CRM software company that sends emails to users every week

Computer Science

TargetCRM is CRM software company that sends emails to users every week. The system has a mailing list of users that are active and able to receive emails as well as users that have been unsubscribed. Users that opt out are removed from the database and the remaining users are considered active and keep receiving emails.

A recurrent issue that TargetCRM has is with computing statistics to analyze the actual state of the mailing list. Because of incorrect user input, there are a lot of email addresses in the mailing list in the wrong format, which is undesirable for the company.

The CTO (Chief Technology Officer) of the company wanted to generate a report to check the quality of the email address data. However, when they aggregated the data to create the report, they noticed that the data quality was not good. As more people started using the application, more erroneous email address entries were found. As the system uses email to contact the end users, that was found to be a critical issue.

Take into account that each user with an incorrectly formatted email address in our mailing list is a final customer to whom we cannot send notifications because their email is unreachable. Knowing this, for this project, TargetCRM wants to filter out these users in order to free up storage space for valid users and, in the future, work toward a way to improve overall data quality.

Your solution will allow TargetCRM to save a considerable amount of money from its monthly budget, because your program will free up a team in the company from doing manual checks every week to filter out incorrectly formatted email address data. Manually checking for errors is a very tedious and repetitive task that is costly and prone to failure, which is why automating this process is crucial for the company.

After finishing this project, your solution will be integrated into the mailing list updater application, and the TargetCRM platform will be updated into a newer version with this functionality.

 

Tasks

1. Write the function is_email_valid to check whether an email address is valid or not. If the address is not, the function throws the custom EmailNotValidError exception.

 

2. Write the function is_email_valid_extended to catch the EmailNotValidError exception and return an error message.

 

3. Write the function is_email_valid_extended_finally that implements the finally block and returns the list of valid email addresses.

 

 

Starter Code:

 

class EmailNotValidError():
    """ Raised when the target email is not valid """



def is_email_valid(mailing_list):
    """
      Your docstring documentation starts here.

      For more information on how to proper document your function, please refer to the official PEP8:
       https://www.python.org/dev/peps/pep-0008/#documentation-strings.

   """

for key, email in  # Loop through the mailing list:

    if '@' not in  # Check if the email contains an @:

        raise  # Raise an EmailNotValidError exception if the @ is not present



def is_email_valid_extended(mailing_list):
     """
       Your docstring documentation starts here.

       For more information on how to proper document your function, please refer to the official PEP8:
        https://www.python.org/dev/peps/pep-0008/#documentation-strings.

    """


    final_users_list = # Array to hold user ids

    # Inserted a try.., except.. block to cast the exception
    try:

        # Loop through the mailing list
        for key, email in # Your mailing list:


            if '@' in # Check if the @ is present in the email:

                # Append the id of users with valid emails

        else:


            raise # Raises an EmailNotValidError otherwise
    except # Your user-defined exception:


        return # Return a user-friendly message to cast the exception



def is_email_valid_extended_finally(mailing_list):
     """
       Your docstring documentation starts here.

       For more information on how to proper document your function, please refer to the official PEP8:
        https://www.python.org/dev/peps/pep-0008/#documentation-strings.

    """

    final_users_list = # Array to hold user ids

    # Inserted a try.., except.. block to cast the exception
    try:
        # Loop through the mailing list
        for key, email in  # Your mailing list:


            if '@' in # Check if the @ is present in the email:

                # Append the id of users with valid emails

        else:


            raise # Raises an EmailNotValidError otherwise
    except # Your user-defined exception:

        # Print a user-friendly message to cast the exception
    finally:

        return # Return the id of the users with valid email

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE