Skip to content

Instantly share code, notes, and snippets.

@MayankFawkes
Created February 26, 2020 09:18
Show Gist options
  • Select an option

  • Save MayankFawkes/b93b62e0880343bd0d49afd4f39d0140 to your computer and use it in GitHub Desktop.

Select an option

Save MayankFawkes/b93b62e0880343bd0d49afd4f39d0140 to your computer and use it in GitHub Desktop.
Python code for https://temp-mail.io/en
'''
Credit : https://temp-mail.io/en
'''
__author__='Mayank Gupta'
import requests
from time import sleep
class TempMail(object):
def __init__(self):
self.Handle()
def Handle(self):
self.id=[]
email=self.GenMail()
self.Logo(email['email'])
while 1:
o=self.GetMail(email['email'])
for n in o:
if n['id'] not in self.id:
self.PrintMail(n)
self.id.append(n['id'])
sleep(2)
def Logo(self,email:str)->print:
o=email
add=int((50-len(o))/2)
o=f'{add*" "}{o}{add*" "}'
logo=b'\t\t\t\xe2\x95\x94\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x97\n\t\t\t\xe2\x95\x91{:<50}\xe2\x95\x91\n\t\t\t\xe2\x95\x9a\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x9d\n\n'
print(logo.decode().format(o))
def GenMail(self):
url='https://api.internal.temp-mail.io/api/v2/email/new'
data={"min_name_length":8,"max_name_length":24}
r=requests.post(url,json=data)
return r.json()
def GetMail(self,email:str)->list:
url=f'https://api.internal.temp-mail.io/api/v2/email/{email}/messages'
return requests.get(url).json()
def PrintMail(self,mail:dict)->print:
print(f"From: {mail['from']}\nCC: {mail['cc']}\nSubject: {mail['subject']}\nDate: {mail['created_at']}\nBody: {mail['body_text']}")
print('-----------------END-----------------')
if __name__ == '__main__':
TempMail()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment