Implementation for MailTrap basic functionalities using Python.
All you need is Python version 3.6 or above
pip3 install mailtrap-handlerFor dedicated documentation click here
from mailtrap_handler import MailTrapHandler
mailtrap = MailTrapHandler(TOKEN, ACCOUNT_ID)
# then do what you need with the mailtrap objectGet mail id:
# default value for title is None
list_of_ids = mailtrap.get_mail_id(inbox, email, title="Some Title here")
# returns a list of found mails idsGet mail html content:
# default value for title is None
# default value for waiting_time is 0
MailTrapHandler.get_mail(inbox, email, title, waiting_time=30)
# returns mail html contentClean the inbox:
MailTrapHandler.clean_inbox(inbox)Delete target mail:
MailTrapHandler.delete_mail(inbox, email, title="Some Title here")
# default value for title is Nonefrom mailtrap_handler import MailTrapHandler
# requirements
token = "123wellthiswouldbeyourtokenhere098"
account_id = 987654
inbox = 12349876 # this is your mailtrap inbox id
email = "[email protected]"
title = "Oy! Congrats on getting Your new T-shirt"
# creating mailtraphandler object
mailtrap = MailTrapHandler(token, account_id)
# getting the html content
mails = mailtrap.get_mail(inbox, email, title=title, 10)
# we do now whatever we need with the recieved mails
# and now we delete this mail
mailtrap.delete_mail(inbox, email, title=title)
# you know what let's just delete every mail in the inbox
mailtrap.clean_inbox(inbox)
# I got no more mails!We welcome issues to and pull requests against this repository!
This repository follows Conventional Commits
<type>(optional scope): <description>
Example: feat(pre-event): Add speakers section
Available types are:
feat: Add table on landing page
, feat: Remove table from landing pagefix: Illustration overflows in mobile viewLabels per page Ex: feat(pre-event): Add date label
If there is no scope needed, you don't need to write it
Description must fully explain what is being done.
Add BREAKING CHANGE in the description if there is a significant change.
If there are multiple changes, then commit one by one
feat: Add somethingfix type, state the issue Ex: fix: File size limiter not workingCommit according to semantic release spec above and let CircleCI (and semantic-release) do the magic.