Fork of MainSilent/MailTm.
There are plans to write a custom server for deploying personal temporary email on your server.
Mail-tm is a free temporary mail service, This library is useful for automation tasks such as making accounts that needs email verification.
pip install git+https://github.com/iamlostshe/mail-tmimport asyncio
from mailtm import Email
async def main() -> None:
"""Start msg cycle."""
def listener(message: dict) -> None:
print("\nSubject: " + message["subject"])
print("Content: " + message["text"] if message["text"] else message["html"])
# Get base url and domains
test = Email()
await test.init()
print("\nBase url:", test.base_url)
print("Domain:", test.domain)
# Make new email address
await test.register()
print("\nEmail Adress:", test.address)
# Start listening
await test.start(listener)
print("\nWaiting for new emails...")
if __name__ == "__main__":
asyncio.run(main())API: api.mail.tm
register(username: str | None = username_gen(), password: str | None = password_gen(), domain: str | None = None):
Make an email account with random credentials, You can also pass a username, password and domain to use the same account.
start(listener: any, interval: int = 3) -> None:
Start listening for new emails, Interval means how many seconds takes to sync, And you also need to pass a function for listener, This function gets called when new email arrive.