temp-mail-python
is a Python wrapper for Temp Mail API. Temp Mail API is a free and secure temporary email service that allows you to receive emails at a temporary address that will self-destruct after a certain period of time. This wrapper library provides an easy-to-use interface for interacting with the Temp Mail API and allows you to create, read and delete temporary emails.
Create a free APILayer account here and subscribe to the Temp Mail API. You will receive an API key that you can use with this wrapper library.
You can install temp-mail-python
using pip:
pip install git+https://github.com/krishna2206/temp-mail-python.git
Import the TempMail
class from temp-mail-python
and initialize it with your Temp Mail API key:
from tempmail import TempMail
tm = TempMail(api_key='YOUR_API_KEY_HERE')
domains = tm.get_domains()
print(domains)
You can either create a temporary email address with a random username or specify a username of your choice.
# Create a temporary email address with a random username
email = tm.create_email()
print(email)
# Create a temporary email address with a specified username
email = tm.create_email(username='example')
print(email)
emails = tm.get_emails('example@example.com')
print(emails)
email = tm.get_email('email_id')
print(email)
attachments = tm.get_attachments('email_id')
print(attachments)
attachment = tm.get_one_attachment('email_id', 'attachment_id')
print(attachment)
response = tm.delete_email('email_id')
print(response)
MIT License
Copyright (c) 2023 Anhy Krishna Fitiavana
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,