You can download this code by clicking the button below.
This code is now available for download.
This function takes two arguments, a part of the name (such as a surname) and a domain, and then generates a random email address using the Faker library.
Technology Stack : Faker library
Code Type : Function
Code Difficulty : Intermediate
def generate_random_email(name, domain):
import random
from faker import Faker
fake = Faker()
email_name = fake.first_name().replace(" ", "") + name
email_domain = fake.domain_name()
return f"{email_name}@{email_domain}"