Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions AutomationScripts/Random Email Generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This is a Python Script which generates random email addresses with domains based on user input

## Libraries used:
- Random
- CSV
- Progressbar
- String


## Requirements

## For this script to run install requirements file

```python
pip install -r requirements.txt
```
## Run the program using command

```
$ python random_email_generator.py
```
## Output
![output](Images/RandomEmail.png)

Contributed by [Pankaj]('https://github.com/pankaj892')
55 changes: 55 additions & 0 deletions AutomationScripts/Random Email Generator/random_email_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import random
import string
import csv
import progressbar

''' Ask user for total number of emails required'''
def getcount():
rownums = input("How many email addresses?: ")
try:
rowint = int(rownums)
return rowint
except ValueError:
print ("Please enter an integer value")
return getcount()

'''Below function creates a random length of email between 1-20 characters length and adds domain and extension to give the resulting email'''

def makeEmail():
extensions = ['com','net','org','gov']
domains = ['gmail','yahoo','comcast','verizon','charter','hotmail','outlook','frontier']

finalext = extensions[random.randint(0,len(extensions)-1)]
finaldom = domains[random.randint(0,len(domains)-1)]

accountlen = random.randint(1,20)

finalacc = ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(accountlen))

finale = finalacc + "@" + finaldom + "." + finalext
return finale

#Take the total count of emails and pass them to getcount()
howmany = getcount()

#counter for While loop
counter = 0

#empty array to add emails
emailarray = []

print ("Creating email addresses...")
print ("Progress: ")

prebar = progressbar.ProgressBar(maxval=int(howmany))

for i in prebar(range(howmany)):
while counter < howmany:
emailarray.append(str(makeEmail()))
counter += 1
prebar.update(i)

print ("Creation completed.")

for i in emailarray:
print(i)
1 change: 1 addition & 0 deletions AutomationScripts/Random Email Generator/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
progressbar33==2.4