No project description provided
Project description
python-mailtrap-handler
Implementation for MailTrap basic functionalities using Python.
Requirements
All you need is Python version 3.6 or above
Installation
pip3 install mailtrap-handler
Usage
For dedicated documentation click here
from mailtrap_handler import MailTrapHandler
mailtrap = MailTrapHandler(TOKEN, ACCOUNT_ID)
# then do what you need with the mailtrap object
Functions
Get 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 ids
Get 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 content
Clean the inbox:
MailTrapHandler.clean_inbox(inbox)
Delete target mail:
MailTrapHandler.delete_mail(inbox, email, title="Some Title here")
# default value for title is None
Example Code
from mailtrap_handler import MailTrapHandler
# requirements
token = "123wellthiswouldbeyourtokenhere098"
account_id = 987654
inbox = 12349876 # this is your mailtrap inbox id
email = "target_email+probably_with_some_alias@inbox.mailtrap.io"
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!
How to Contribute
We welcome issues to and pull requests against this repository!
Commit Message Convention
This repository follows Conventional Commits
Format
<type>(optional scope): <description>
Example: feat(pre-event): Add speakers section
1. Type
Available types are:
- feat → Changes about addition or removal of a feature. Ex:
feat: Add table on landing page
,feat: Remove table from landing page
- fix → Bug fixing, followed by the bug. Ex:
fix: Illustration overflows in mobile view
- docs → Update documentation (README.md)
- style → Updating style, and not changing any logic in the code (reorder imports, fix whitespace, remove comments)
- chore → Installing new dependencies, or bumping deps
- refactor → Changes in code, same output, but different approach
- ci → Update github workflows, husky
- test → Update testing suite, cypress files
- revert → when reverting commits
- perf → Fixing something regarding performance (deriving state, using memo, callback)
2. Optional Scope
Labels per page Ex: feat(pre-event): Add date label
If there is no scope needed, you don't need to write it
3. Description
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
- After colon, there are a single space Ex:
feat: Add something
- When using
fix
type, state the issue Ex:fix: File size limiter not working
- Use imperative, dan present tense: "change" not "changed" or "changes"
- Use capitals in front of the sentence
- Don't add full stop (.) at the end of the sentence
Publish new release
Commit according to semantic release spec above and let CircleCI (and semantic-release) do the magic.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file mailtrap_handler-0.2.tar.gz
.
File metadata
- Download URL: mailtrap_handler-0.2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2052311721cee65f452bc77308a89c945edfcde5ba8f8e40d837d13f2493caf |
|
MD5 | f8e975df4291075ed5cddd7a37aeb934 |
|
BLAKE2b-256 | be39148bdb78a1b8be58d3287fc70da925f58e6c910f680e7c9ed57150800a82 |
File details
Details for the file mailtrap_handler-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: mailtrap_handler-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f3fa0e7396bc5a6736a559aa92d51049e7cd1d8f37b1c1018ab3e7cbcd7af0f |
|
MD5 | 23c43b258ef4bb4e7fd031914ad5cb6f |
|
BLAKE2b-256 | b8ca2112ff8898a71e302afb80dd3214c55b5f16ecefcc0f450be23ecb5610dc |
File details
Details for the file mailtrap_handler-0.2-py3-none-any.whl
.
File metadata
- Download URL: mailtrap_handler-0.2-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cf34cf0c0362431700acafdbab0c9c15604c66dbc02507d167b90d08329ee65 |
|
MD5 | 79fdad1f8c521c70ed5995518ce404f9 |
|
BLAKE2b-256 | 41ab09afc91fe0d16053f6285d3d107f70027938c1fec2fe57d56b8a28dcb471 |