You can download this code by clicking the button below.
This code is now available for download.
This function takes two parameters: user name and 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(user_name, domain):
import random
from faker import Faker
fake = Faker()
email = f"{fake.first_name().lower()}+{user_name.lower()}@{domain}"
return email