Mailosaur allows you to automate tests that require email. You can also use it for manual testing as it gives you unlimited test email addresses or use it as a fake/dummy SMTP service.
For more info go to [mailosaur.com](https://mailosaur.com/)
## Installation
pip install mailosaur
## Usage
```python
from mailosaur.mailosaur import Mailosaur
from unittest import TestCase
mailbox = Mailosaur(mailbox_id, api_key)
emails = mailbox.get_emails_by_recipient('anything.1eaaeef6@mailosaur.in')
assertEqual('something', emails[0].subject, 'The subject should be something')
```
##Api
*functions:*
- **Email[] get_emails(search_pattern)** - Retrieves all emails which have the searchPattern text in their body or subject.
- **Email[] get_emails_by_recipient(recipientEmail)** -
Retrieves all emails sent to the given recipient.
- **Email get_email(email_id)** -
Retrieves the email with the given id.
- **delete_all_email()** -
Deletes all emails in a mailbox.
- **delete_email(email_id)** -
Deletes the email with the given id.
- **get_attachment(attachment_id)** -
Retrieves the attachment with specified id as a byte array.
- **get_raw_email(raw_id)** -
Retrieves the complete raw EML file for the rawId given as a byte array. raw_id is a property on the email object.
- **generate_email_address()** -
Generates a random email address which can be used to send emails into the mailbox.
*structures*
- **Email** - The core object returned by the Mailosaur API
- **id** - The email identifier
- **creation_date** - The date your email was received by Mailosaur
- **sender_host** - The host name of the machine that sent the email
- **raw_id** - Reference for raw email data
- **html** - The HTML content of the email
- **links** - All links found within the HTML content of the email
- **images** - All images found within the HTML content of the email
- **body** - Unescaped HTML body of the email
- **text** - The text content of the email
- **links** - All links found within the text content of the email
- **body** - Text body of the email
- **headers** - Contains all email headers as object properties
- **subject** - Email subject
- **priority** - Email priority
- **from** - Details of email sender(s)
- **address** - Email address
- **name** - Email sender name
- **to** - Details of email recipient(s)
- **address** - Email address
- **name** - Email recipient name
- **attachments** - Details of any attachments found within the email
- **id** - Attachment identifier
- **file_name** - Attachment file name
- **length** - Attachment file size (in bytes)
- **content_type** - Attachment mime type (e.g. "image/png")
Metadata
Release files for mailosaur 3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mailosaur-3.0.tar.gz | 4.2 kB | Without provenance | Details for mailosaur-3.0.tar.gz |
Release files / mailosaur-3.0.tar.gz
| Download URL | mailosaur-3.0.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22965e45cb4c1be48a3137961426982d9bb7e81f77592835aa8b6e4770c598f9
|
|
BLAKE2b-256 checksum How to use checksums |
f2ed1a24b3fd07d5fe0b00ad5eeca3764b9f6b958895be4d01a606997df2949e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for mailosaur 3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.