Random Email Generator Using Mimesis Library

  • Share this:

Code introduction


This function uses the Person class from the Mimesis library to generate random names and domains, then combines them to form an email address.


Technology Stack : Mimesis, Python

Code Type : Generate random user emails

Code Difficulty : Intermediate


                
                    
def generate_random_user_email():
    import random
    from mimesis import Person

    def random_email(name, domain):
        return f"{name.lower()}.{domain.lower()}"

    person = Person()
    first_name = person.first_name()
    last_name = person.last_name()
    domain = person.domain()

    email = random_email(first_name, last_name)
    return email                
              
Tags: