10 minute mail with password generator
A 10-minute mail with a password generator! That's a great idea. Here's a simple implementation using Python and the random
and string
libraries:
10-Minute Mail with Password Generator (Python)
import random
import string
class TenMinuteMail:
def __init__(self):
self.emails = {}
def generate_email(self):
email = f"temp{random.randint(100000, 999999)}@{random.choice(['gmail', 'yahoo', 'hotmail'])}.com"
password = self.generate_password()
self.emails[email] = password
return email, password
def generate_password(self):
length = 12
chars = string.ascii_letters + string.digits + string.punctuation
password = ''.join(random.choice(chars) for _ in range(length))
return password
def get_email_password(self, email):
if email in self.emails:
return self.emails[email]
return None
def delete_email(self, email):
if email in self.emails:
del self.emails[email]
# Create an instance of the 10-minute mail
mail = TenMinuteMail()
# Generate a new email and password
email, password = mail.generate_email()
print(f"Email: {email}, Password: {password}")
# Get the password for an existing email
email = "[email protected]"
password = mail.get_email_password(email)
print(f"Password for {email}: {password}")
# Delete an email
mail.delete_email("[email protected]")
Here's how it works:
- The
TenMinuteMail
class has methods to generate a new email and password, retrieve the password for an existing email, and delete an email. - The
generate_email
method generates a random email address using a combination of a random number and a random email provider (Gmail, Yahoo, or Hotmail). - The
generate_password
method generates a random password using a combination of uppercase and lowercase letters, digits, and punctuation characters. - The
get_email_password
method retrieves the password for an existing email address. - The
delete_email
method deletes an email address.
You can use this code to generate a new email and password, retrieve the password for an existing email, and delete an email. Note that this is a simple implementation and you may want to add additional features, such as email validation and password strength checking.
Security Note
Please keep in mind that this is a simple implementation and not suitable for production use. In a real-world scenario, you would want to use a more secure method to generate and store passwords, such as using a cryptographically secure pseudo-random number generator and storing the passwords securely using a password hashing algorithm.