def generate_email(first, last, domain):
emails= set()
for start in ["", first, first[0]]:
for middle in ["", "."]:
for end in ["", last, last[0]]:
if ((start=="" and end=="") or ((start=="" or end=="") and middle!="")):
continue
emails.add((start+middle+end+"@"+domain).lower()+";")
emails.add((end+middle+start+"@"+domain).lower()+";")
for email in emails:
print email,
#This will generate possible email addresses for John Smith of example.com
#sj@example.com; js@example.com; s.j@example.com; sjohn@example.com; smith.john@example.com; s.john@example.com; johns@example.com; smith@example.com; john.smith@example.com; j.smith@example.com; john.s@example.com; s@example.com; smithjohn@example.com; jsmith@example.com; smithj@example.com; johnsmith@example.com; john@example.com; j.s@example.com; j@example.com; smith.j@example.com;
generate_email("John", "Smith", "example.com")
emails
Posted
Author Stephen Easley-Walsh