├── LICENSE ├── README.md ├── TMP.py └── requirements.txt /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 mr_mowhn 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # TMP-mail 3 | 4 | TMP-mail is a Python-based utility for creating temporary email addresses, managing inboxes, and interacting with messages seamlessly. By leveraging reverse-engineering techniques, TMP-mail provides an unofficial API for **inboxes.com**, offering powerful capabilities to access temporary email services via a terminal interface. 5 | 6 | --- 7 | 8 | ## Features 9 | 10 | - **Generate Temporary Emails**: Create email addresses with random or custom usernames. 11 | - **Fetch Emails**: Refresh the inbox. 12 | - **View Email Content**: Display the full content of received emails, including attachments. 13 | - **Delete Inboxes**: Safely delete temporary inboxes when no longer needed. 14 | - **Custom Domains**: Choose from over 20 domain options for your temporary address. 15 | - **Unofficial API Integration**: Access temporary email services using reverse-engineered API endpoints. 16 | - **User-Friendly Terminal Interface**: Intuitive interface with color-coded responses for ease of use. 17 | 18 | --- 19 | 20 | ## Prerequisites 21 | 22 | - **Python 3.x** 23 | - Required Python libraries (listed in `requirements.txt`): 24 | - `requests` 25 | - `pyfiglet` 26 | - `colorama` 27 | 28 | --- 29 | 30 | ## Installation 31 | 32 | 1. Clone the repository: 33 | ```bash 34 | git clone https://github.com/mowhn/TMP-mail.git 35 | cd TMP-mail 36 | ``` 37 | 38 | 2. Install dependencies: 39 | ```bash 40 | pip install -r requirements.txt 41 | ``` 42 | 43 | --- 44 | 45 | ## Usage 46 | 47 | 1. Run the tool: 48 | ```bash 49 | python TMP.py 50 | ``` 51 | 52 | 2. Follow the on-screen prompts to: 53 | - Generate a temporary email address (random or custom). 54 | - Fetch and refresh the inbox to check for new emails. 55 | - Access the full content of messages. 56 | - Delete temporary inboxes when done. 57 | 58 | --- 59 | 60 | ## Options 61 | 62 | ### 1. Generate Temporary Email 63 | Create a disposable email with customizable username options. 64 | 65 | ### 2. Fetch Emails 66 | Refresh the inbox to check for new emails. 67 | 68 | ### 3. View Email Content 69 | Open and display the body and metadata of a selected email. 70 | 71 | ### 4. Delete Inbox 72 | Permanently remove the temporary email inbox. 73 | 74 | --- 75 | 76 | ## Disclaimer 77 | 78 | **Important**: TMP-mail uses reverse engineering to interact with the unofficial API of **inboxes.com**. This tool is not officially affiliated with or supported by **inboxes.com**, and its usage may violate the website's terms of service. Users are responsible for using this tool ethically and in compliance with applicable laws. 79 | 80 | --- 81 | 82 | ## License 83 | 84 | This project is licensed under the [MIT License](LICENSE). 85 | -------------------------------------------------------------------------------- /TMP.py: -------------------------------------------------------------------------------- 1 | import requests, os, random, string, time, pyfiglet 2 | from colorama import Fore, init 3 | import locale 4 | 5 | init(autoreset=True) 6 | 7 | # Language configurations 8 | LANGUAGES = { 9 | "en": { 10 | "menu_title": "Welcome to TMP-mail tool by mowhn! Please select an option:", 11 | "current_mail": "Your Mail: {}", 12 | "no_mail": "Mail: No temporary email generated", 13 | "menu_options": [ 14 | "Generate Temporary Email", 15 | "Fetch Emails", 16 | "View Email Content", 17 | "Delete Email", 18 | "Exit" 19 | ], 20 | "available_domains": "Available domains:", 21 | "choose_domain": "Choose a domain (1-{}):", 22 | "email_gen_options": [ 23 | "Randomly generate username", 24 | "Custom username" 25 | ], 26 | "email_gen_prompt": "How would you like to generate your temporary email with domain '{}'?", 27 | "enter_username": "Enter your custom username:", 28 | "email_deleted": "Temporary email '{}' deleted successfully.", 29 | "no_messages": "No messages to view.", 30 | "message_list_format": "{}. From: {} Subject: {}", 31 | "view_message_prompt": "Enter the message number to view full content:", 32 | "email_content_header": "Full Email Content:", 33 | "press_enter": "Press Enter to go back to the menu.", 34 | "invalid_message": "Invalid message number.", 35 | "invalid_input": "Invalid input.", 36 | "generate_first": "You need to generate an email first.", 37 | "no_email_delete": "No email to delete.", 38 | "invalid_choice": "Invalid input. Please enter a number between 1 and {}.", 39 | "choose_option": "Choose an option:" 40 | }, 41 | "zh": { 42 | "menu_title": "欢迎使用 TMP-mail 工具!请选择一个选项:", 43 | "current_mail": "当前邮箱: {}", 44 | "no_mail": "邮箱: 尚未生成临时邮箱", 45 | "menu_options": [ 46 | "生成临时邮箱", 47 | "获取邮件", 48 | "查看邮件内容", 49 | "删除邮箱", 50 | "退出" 51 | ], 52 | "available_domains": "可用域名:", 53 | "choose_domain": "请选择域名 (1-{}):", 54 | "email_gen_options": [ 55 | "随机生成用户名", 56 | "自定义用户名" 57 | ], 58 | "email_gen_prompt": "请选择如何生成域名为 '{}' 的临时邮箱?", 59 | "enter_username": "请输入自定义用户名:", 60 | "email_deleted": "临时邮箱 '{}' 已成功删除。", 61 | "no_messages": "没有可查看的邮件。", 62 | "message_list_format": "{}. 发件人: {} 主题: {}", 63 | "view_message_prompt": "请输入要查看的邮件编号:", 64 | "email_content_header": "邮件完整内容:", 65 | "press_enter": "按回车键返回菜单。", 66 | "invalid_message": "无效的邮件编号。", 67 | "invalid_input": "无效的输入。", 68 | "generate_first": "请先生成一个临时邮箱。", 69 | "no_email_delete": "没有可删除的邮箱。", 70 | "invalid_choice": "无效的输入。请输入1到{}之间的数字。", 71 | "choose_option": "请选择一个选项:" 72 | } 73 | } 74 | 75 | BASE_URL = "https://inboxes.com" 76 | HEADERS = { 77 | "authority": "inboxes.com", "accept": "*/*", "accept-language": "en-US,en;q=0.9", 78 | "referer": "https://inboxes.com/", "sec-ch-ua": '"Not-A.Brand";v="99", "Chromium";v="124"', 79 | "sec-ch-ua-mobile": "?1", "sec-ch-ua-platform": '"Android"', "sec-fetch-dest": "empty", "sec-fetch-mode": "cors", 80 | "sec-fetch-site": "same-origin", "user-agent": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Mobile Safari/537.36", 81 | } 82 | 83 | def clear_terminal(): 84 | os.system("cls" if os.name == "nt" else "clear") 85 | 86 | def print_banner(): 87 | print(Fore.GREEN + pyfiglet.figlet_format("TMP-mail by mowhn", font="slant")) 88 | 89 | def get_language(): 90 | clear_terminal() 91 | print_banner() 92 | print(f"{Fore.CYAN}Please select language / 请选择语言:") 93 | print(f"{Fore.GREEN}1. English") 94 | print(f"{Fore.GREEN}2. 中文") 95 | 96 | while True: 97 | try: 98 | choice = int(input(f"{Fore.MAGENTA}Enter choice / 输入选项 (1-2): ").strip()) 99 | if choice == 1: 100 | return "en" 101 | elif choice == 2: 102 | return "zh" 103 | else: 104 | print(f"{Fore.RED}Invalid choice / 无效选项") 105 | except ValueError: 106 | print(f"{Fore.RED}Invalid input / 无效输入") 107 | 108 | CURRENT_LANG = get_language() 109 | TEXTS = LANGUAGES[CURRENT_LANG] 110 | 111 | def fetch_domains_mowhn(): 112 | try: 113 | response = requests.get(f"{BASE_URL}/api/v2/domain", headers=HEADERS) 114 | if response.status_code == 200: 115 | domains = response.json().get("domains", []) 116 | return [domain["qdn"] for domain in domains] 117 | return [] 118 | except Exception: 119 | return [] 120 | 121 | def create_temp_mail_mowhn(username: str, domain: str) -> str | None: 122 | try: 123 | email = f"{username}@{domain}" 124 | response = requests.get(f"{BASE_URL}/api/v2/inbox/{email}", headers=HEADERS) 125 | return email if response.status_code == 200 else None 126 | except Exception: 127 | return None 128 | 129 | def generate_random_username_mowhn(length: int = 8) -> str: 130 | return ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(length)) 131 | 132 | def get_emails_mowhn(email: str) -> list: 133 | try: 134 | response = requests.get(f"{BASE_URL}/api/v2/inbox/{email}", headers=HEADERS) 135 | return response.json().get("msgs", []) if response.status_code == 200 else [] 136 | except Exception: 137 | return [] 138 | 139 | def fetch_email_content_mowhn(uid: str) -> dict | None: 140 | try: 141 | response = requests.get(f"{BASE_URL}/api/v2/message/{uid}", headers=HEADERS) 142 | return response.json() if response.status_code == 200 else None 143 | except Exception: 144 | return None 145 | 146 | def delete_email_mowhn(email): 147 | response = requests.delete(f"{BASE_URL}/api/v2/inbox/{email}", headers=HEADERS) 148 | if response.status_code == 200: 149 | print(f"{Fore.YELLOW}{TEXTS['email_deleted'].format(email)}") 150 | 151 | def prompt_for_choice_mowhn(options, prompt_message): 152 | while True: 153 | print(f"\n{Fore.CYAN}{prompt_message}") 154 | for idx, option in enumerate(options, 1): print(f"{Fore.GREEN}{idx}. {option}") 155 | try: 156 | choice = int(input(f"{Fore.MAGENTA}{TEXTS['choose_option']} ").strip()) 157 | if 1 <= choice <= len(options): return choice 158 | except ValueError: 159 | print(f"{Fore.RED}{TEXTS['invalid_choice'].format(len(options))}") 160 | 161 | def handle_generate_email_mowhn(temp_email): 162 | if temp_email: 163 | delete_email_mowhn(temp_email) 164 | 165 | domains = fetch_domains_mowhn() 166 | if not domains: return None 167 | print(f"\n{Fore.YELLOW}{TEXTS['available_domains']}") 168 | 169 | available_domains = domains[:20] 170 | for idx, domain in enumerate(available_domains, 1): 171 | print(f"{Fore.CYAN}{idx}. {domain}") 172 | 173 | domain_choice = int(input(f"{Fore.MAGENTA}{TEXTS['choose_domain'].format(len(available_domains))}: ").strip()) - 1 174 | if domain_choice < 0 or domain_choice >= len(available_domains): return None 175 | 176 | selected_domain = available_domains[domain_choice] 177 | choice = prompt_for_choice_mowhn( 178 | TEXTS['email_gen_options'], 179 | f"{Fore.GREEN}{TEXTS['email_gen_prompt'].format(selected_domain)}" 180 | ) 181 | 182 | if choice == 1: 183 | return create_temp_mail_mowhn(generate_random_username_mowhn(), selected_domain) 184 | elif choice == 2: 185 | return create_temp_mail_mowhn( 186 | input(f"{Fore.MAGENTA}{TEXTS['enter_username']} ").strip(), 187 | selected_domain 188 | ) 189 | 190 | def handle_view_email_content_mowhn(messages): 191 | if not messages: 192 | print(f"{Fore.RED}{TEXTS['no_messages']}") 193 | return 194 | 195 | for i, msg in enumerate(messages, 1): 196 | print(TEXTS['message_list_format'].format( 197 | f"{Fore.GREEN}{i}", 198 | f"{Fore.YELLOW}{msg['f']}", 199 | f"{Fore.YELLOW}{msg['s']}" 200 | )) 201 | 202 | try: 203 | msg_num = int(input(f"\n{Fore.MAGENTA}{TEXTS['view_message_prompt']} ").strip()) 204 | if 1 <= msg_num <= len(messages): 205 | email_content = fetch_email_content_mowhn(messages[msg_num - 1]["uid"]) 206 | if email_content: 207 | print(f"\n{Fore.CYAN}{TEXTS['email_content_header']}\n" 208 | f"{Fore.YELLOW}From: {email_content['f']}\n" 209 | f"{Fore.YELLOW}Subject: {email_content['s']}\n" 210 | f"{Fore.WHITE}Text: {email_content['text']}") 211 | 212 | input(f"\n{Fore.MAGENTA}{TEXTS['press_enter']}") 213 | else: 214 | print(f"{Fore.RED}{TEXTS['invalid_message']}") 215 | except ValueError: 216 | print(f"{Fore.RED}{TEXTS['invalid_input']}") 217 | 218 | def main_mowhn(): 219 | clear_terminal() 220 | print_banner() 221 | 222 | temp_email, messages = None, [] 223 | try: 224 | while True: 225 | menu_message = (TEXTS['current_mail'].format(temp_email) 226 | if temp_email else TEXTS['no_mail']) 227 | choice = prompt_for_choice_mowhn( 228 | TEXTS['menu_options'], 229 | f"{menu_message}\n\n{TEXTS['menu_title']}" 230 | ) 231 | 232 | if choice == 1: 233 | temp_email = handle_generate_email_mowhn(temp_email) 234 | if temp_email: messages = get_emails_mowhn(temp_email) 235 | elif choice == 2: 236 | if temp_email: messages = get_emails_mowhn(temp_email) 237 | else: print(f"{Fore.RED}{TEXTS['generate_first']}") 238 | elif choice == 3: 239 | if temp_email: handle_view_email_content_mowhn(messages) 240 | else: print(f"{Fore.RED}{TEXTS['generate_first']}") 241 | elif choice == 4: 242 | if temp_email: 243 | delete_email_mowhn(temp_email) 244 | temp_email = None 245 | messages = [] 246 | else: print(f"{Fore.RED}{TEXTS['no_email_delete']}") 247 | elif choice == 5: 248 | if temp_email: 249 | # 静默删除,不显示消息 250 | requests.delete(f"{BASE_URL}/api/v2/inbox/{temp_email}", headers=HEADERS) 251 | break 252 | 253 | time.sleep(2) 254 | clear_terminal() 255 | finally: 256 | if temp_email: 257 | # 静默删除,不显示消息 258 | requests.delete(f"{BASE_URL}/api/v2/inbox/{temp_email}", headers=HEADERS) 259 | 260 | if __name__ == "__main__": 261 | main_mowhn() 262 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests 2 | pyfiglet 3 | colorama 4 | --------------------------------------------------------------------------------