mailslurp-client-9.0.0
9.0.0
8.7.1
8.7.0
8.6.0
8.5.5
8.5.4
8.5.3
8.5.2
8.5.1
8.5.0
8.4.3
8.4.2
8.4.1
8.4.0
8.3.1
8.3.0
8.2.9
8.2.8
8.2.7
8.2.6
8.2.5
8.2.4
8.2.2
8.2.17
8.2.16
8.2.15
8.2.14
8.2.12
8.2.11
8.2.10
8.2.1
8.1.1
8.1.0
8.0.9
8.0.6
8.0.5
8.0.4
8.0.3
8.0.23
8.0.22
8.0.21
8.0.2
8.0.19
8.0.18
8.0.17
8.0.16
8.0.15
8.0.14
8.0.13
8.0.12
8.0.11
8.0.10
8.0.1
7.0.9
7.0.7
7.0.6
7.0.5
7.0.4
7.0.10
4.3.2
4.3.1
4.3.0
4.2.0
4.1.2
4.1.1
4.1.0
4.0.2
17.0.0
16.2.5
16.2.4
16.2.3
16.2.1
16.2.0
16.1.5
16.1.4
16.1.3
16.1.2
16.1.1
16.1.0
16.0.8
16.0.7
16.0.6
16.0.5
16.0.4
16.0.2
15.9.0
15.8.1
15.8.0
15.7.8
15.7.7
15.7.5
15.7.4
15.7.17
15.7.16
15.7.15
15.7.14
15.7.13
15.7.12
15.7.10
15.7.1
15.7.0
15.6.0
15.5.6
15.5.5
15.5.4
15.5.1
15.5.0
15.4.2
15.4.1
15.4.0
15.3.1
15.3.0
15.21.1
15.21.0
15.2.8
15.2.7
15.2.6
15.2.5
15.2.4
15.2.2
15.2.1
15.2.0
15.19.9
15.19.8
15.19.7
15.19.6
15.19.5
15.19.4
15.19.3
15.19.22
15.19.21
15.19.20
15.19.2
15.19.19
15.19.18
15.19.17
15.19.16
15.19.14
15.19.13
15.19.12
15.19.11
15.19.10
15.19.1
15.19.0
15.18.5
15.18.4
15.18.3
15.18.2
15.18.1
15.18.0
15.17.9
15.17.8
15.17.7
15.17.6
15.17.5
15.17.41
15.17.40
15.17.4
15.17.39
15.17.38
15.17.37
15.17.3
15.17.2
15.17.17
15.17.16
15.17.15
15.17.14
15.17.13
15.17.12
15.17.11
15.17.10
15.17.1
15.17.0
15.16.9
15.16.8
15.16.7
15.16.6
15.16.5
15.16.4
15.16.3
15.16.22
15.16.21
15.16.20
15.16.2
15.16.19
15.16.18
15.16.17
15.16.16
15.16.15
15.16.14
15.16.13
15.16.12
15.16.11
15.16.10
15.16.1
15.16.0
15.15.5
15.15.4
15.15.2
15.15.1
15.14.0
15.13.9
15.13.8
15.13.7
15.13.6
15.13.5
15.13.4
15.13.32
15.13.31
15.13.30
15.13.3
15.13.29
15.13.28
15.13.27
15.13.26
15.13.25
15.13.24
15.13.23
15.13.22
15.13.21
15.13.20
15.13.2
15.13.19
15.13.18
15.13.17
15.13.16
15.13.15
15.13.14
15.13.13
15.13.11
15.13.10
15.13.1
15.13.0
15.12.3
15.12.2
15.12.17
15.12.16
15.12.15
15.12.14
15.12.13
15.12.12
15.12.11
15.12.1
15.12.0
15.11.1
15.11.0
15.1.4
15.1.3
15.1.2
15.1.1
15.1.0
15.0.8
15.0.7
15.0.6
15.0.5
15.0.4
15.0.3
15.0.2
15.0.1
15.0.0
14.0.6
14.0.5
14.0.3
14.0.2
14.0.1
14.0.0
13.1.0
13.0.1
13.0.0
12.8.4
12.8.3
12.8.2
12.8.1
12.8.0
12.7.1
12.7.0
12.6.4
12.6.3
12.6.1
12.6.0
12.5.0
12.4.8
12.4.7
12.4.6
12.4.5
12.4.4
12.4.2
12.4.1
12.4.0
12.3.333
12.3.2
12.3.1
12.3.0
12.2.2
12.2.1
12.2.0
12.1.3333
12.1.32
12.1.31
12.1.30
12.1.29
12.1.28
12.1.27
12.1.26
12.1.25
12.1.24
12.1.23
12.1.22
12.1.1
12.1.0
12.0.0
11.9.7
11.9.6
11.9.4
11.9.3
11.9.2
11.9.1
11.9.0
11.8.9
11.8.8
11.8.6
11.8.5
11.8.4
11.8.3
11.8.2
11.8.13
11.8.12
11.8.11
11.8.10
11.8.1
11.8.0
11.7.9
11.7.8
11.7.7
11.7.6
11.7.509
11.7.508
11.7.506
11.7.505
11.7.502
11.7.501
11.7.500
11.7.5
11.7.400
11.7.4
11.7.314
11.7.313
11.7.312
11.7.311
11.7.310
11.7.309
11.7.308
11.7.307
11.7.306
11.7.305
11.7.304
11.7.302
11.7.301
11.7.300
11.7.215
11.7.214
11.7.213
11.7.212
11.7.211
11.7.210
11.7.203
11.7.202
11.7.201
11.7.200
11.7.2
11.7.122
11.7.11
11.7.10
11.7.1
11.7.0
11.6.9
11.6.8
11.6.7
11.6.6
11.6.5
11.6.4
11.6.3
11.6.24
11.6.23
11.6.22
11.6.21
11.6.20
11.6.2
11.6.19
11.6.18
11.6.16
11.6.15
11.6.14
11.6.13
11.6.12
11.6.11
11.6.10
11.6.1
11.5.9
11.5.8
11.5.7
11.5.6
11.5.5
11.5.4
11.5.3
11.5.2333
11.5.22
11.5.21
11.5.20
11.5.2
11.5.12
11.5.11
11.5.10
11.5.1
11.5.0
11.4.25
11.4.24
11.4.23
11.4.22
11.4.0
11.3.0
11.2.0
11.16666.0
11.15.0
11.14.0
11.13.0
11.12.0
11.11.1
11.11.0
11.10.3
11.10.2
11.10.1
11.10.0
11.1.1
11.1.0
11.0.1
11.0.0
9.0.0
8.7.1
8.7.0
8.6.0
8.5.5
8.5.4
8.5.3
8.5.2
8.5.1
8.5.0
8.4.3
8.4.2
8.4.1
8.4.0
8.3.1
8.3.0
8.2.9
8.2.8
8.2.7
8.2.6
8.2.5
8.2.4
8.2.2
8.2.17
8.2.16
8.2.15
8.2.14
8.2.12
8.2.11
8.2.10
8.2.1
8.1.1
8.1.0
8.0.9
8.0.6
8.0.5
8.0.4
8.0.3
8.0.23
8.0.22
8.0.21
8.0.2
8.0.19
8.0.18
8.0.17
8.0.16
8.0.15
8.0.14
8.0.13
8.0.12
8.0.11
8.0.10
8.0.1
7.0.9
7.0.6
7.0.5
7.0.4
7.0.10
4.3.2
4.3.1
4.3.0
4.2.0
4.1.2
4.1.0
4.0.2
17.0.0
16.2.5
16.2.4
16.2.3
16.2.1
16.2.0
16.1.5
16.1.4
16.1.3
16.1.2
16.1.1
16.1.0
16.0.8
16.0.7
16.0.6
16.0.5
16.0.4
16.0.2
15.9.0
15.8.1
15.8.0
15.7.8
15.7.7
15.7.5
15.7.4
15.7.17
15.7.16
15.7.15
15.7.14
15.7.13
15.7.12
15.7.10
15.7.1
15.7.0
15.6.0
15.5.6
15.5.5
15.5.4
15.5.1
15.5.0
15.4.2
15.4.1
15.4.0
15.3.1
15.3.0
15.21.1
15.21.0
15.2.8
15.2.7
15.2.6
15.2.5
15.2.4
15.2.2
15.2.1
15.2.0
15.19.9
15.19.8
15.19.7
15.19.6
15.19.5
15.19.4
15.19.3
15.19.22
15.19.21
15.19.20
15.19.2
15.19.19
15.19.18
15.19.17
15.19.16
15.19.14
15.19.13
15.19.12
15.19.11
15.19.10
15.19.1
15.19.0
15.18.5
15.18.4
15.18.3
15.18.2
15.18.1
15.18.0
15.17.9
15.17.8
15.17.7
15.17.6
15.17.5
15.17.41
15.17.40
15.17.4
15.17.39
15.17.38
15.17.37
15.17.3
15.17.2
15.17.17
15.17.16
15.17.15
15.17.14
15.17.13
15.17.12
15.17.11
15.17.10
15.17.1
15.17.0
15.16.9
15.16.8
15.16.7
15.16.6
15.16.5
15.16.4
15.16.3
15.16.22
15.16.21
15.16.20
15.16.2
15.16.19
15.16.18
15.16.17
15.16.16
15.16.15
15.16.14
15.16.13
15.16.12
15.16.11
15.16.10
15.16.1
15.16.0
15.15.5
15.15.4
15.15.2
15.15.1
15.14.0
15.13.9
15.13.8
15.13.7
15.13.6
15.13.5
15.13.4
15.13.32
15.13.31
15.13.30
15.13.3
15.13.29
15.13.28
15.13.27
15.13.26
15.13.25
15.13.24
15.13.23
15.13.22
15.13.21
15.13.20
15.13.2
15.13.19
15.13.18
15.13.17
15.13.16
15.13.15
15.13.14
15.13.13
15.13.11
15.13.10
15.13.1
15.13.0
15.12.3
15.12.2
15.12.17
15.12.16
15.12.15
15.12.14
15.12.13
15.12.12
15.12.11
15.12.1
15.12.0
15.11.1
15.11.0
15.1.4
15.1.3
15.1.2
15.1.1
15.1.0
15.0.8
15.0.7
15.0.6
15.0.5
15.0.4
15.0.3
15.0.2
15.0.1
15.0.0
14.0.6
14.0.5
14.0.3
14.0.2
14.0.1
14.0.0
13.1.0
13.0.1
13.0.0
12.8.4
12.8.3
12.8.2
12.8.1
12.8.0
12.7.1
12.7.0
12.6.4
12.6.3
12.6.1
12.6.0
12.5.0
12.4.8
12.4.7
12.4.6
12.4.5
12.4.4
12.4.2
12.4.1
12.4.0
12.3.333
12.3.2
12.3.1
12.3.0
12.2.2
12.2.1
12.2.0
12.1.3333
12.1.32
12.1.31
12.1.30
12.1.29
12.1.28
12.1.27
12.1.26
12.1.25
12.1.24
12.1.23
12.1.22
12.1.1
12.1.0
12.0.0
11.9.7
11.9.6
11.9.4
11.9.3
11.9.2
11.9.1
11.9.0
11.8.9
11.8.8
11.8.6
11.8.5
11.8.4
11.8.3
11.8.2
11.8.13
11.8.12
11.8.11
11.8.10
11.8.1
11.8.0
11.7.9
11.7.8
11.7.7
11.7.6
11.7.509
11.7.508
11.7.506
11.7.505
11.7.502
11.7.501
11.7.500
11.7.5
11.7.400
11.7.4
11.7.314
11.7.313
11.7.312
11.7.311
11.7.310
11.7.309
11.7.308
11.7.307
11.7.306
11.7.305
11.7.304
11.7.302
11.7.301
11.7.300
11.7.215
11.7.214
11.7.213
11.7.212
11.7.211
11.7.210
11.7.203
11.7.202
11.7.201
11.7.200
11.7.2
11.7.122
11.7.11
11.7.10
11.7.1
11.7.0
11.6.9
11.6.8
11.6.7
11.6.6
11.6.5
11.6.4
11.6.3
11.6.24
11.6.23
11.6.22
11.6.21
11.6.20
11.6.2
11.6.19
11.6.18
11.6.16
11.6.15
11.6.14
11.6.13
11.6.12
11.6.11
11.6.10
11.6.1
11.5.9
11.5.8
11.5.7
11.5.6
11.5.5
11.5.4
11.5.3
11.5.2333
11.5.22
11.5.21
11.5.20
11.5.2
11.5.12
11.5.11
11.5.10
11.5.1
11.5.0
11.4.25
11.4.24
11.4.23
11.4.22
11.4.0
11.3.0
11.2.0
11.16666.0
11.15.0
11.14.0
11.13.0
11.12.0
11.11.1
11.11.0
11.10.3
11.10.2
11.10.1
11.10.0
11.1.1
11.1.0
11.0.1
11.0.0
توضیحات
Official MailSlurp Python SDK Email API
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | mailslurp-client-9.0.0 |
| نام | mailslurp-client |
| نسخه کتابخانه | 9.0.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | MailSlurp |
| ایمیل نویسنده | contact@mailslurp.dev |
| آدرس صفحه اصلی | https://www.mailslurp.com/python |
| آدرس اینترنتی | https://pypi.org/project/mailslurp-client/ |
| مجوز | - |
# MailSlurp Python Client
> Create real email addresses on demand. Send and receive emails and attachments from code and tests using Python.
MailSlurp is an email API service that lets you create real email addresses in code. You can then send and receive emails and attachments in Python applications and tests.
## Video tutorial
[](https://youtu.be/tcLJ3xX-H88)
## Quick links
- [API documentation](https://docs.mailslurp.com/api/)
- [Method Documentation](https://python.mailslurp.com/)
- [PyPI Package](https://pypi.org/project/mailslurp-client/)
- [Github Source](https://github.com/mailslurp/mailslurp-client-python)
- [Send email using SMTP in Python](https://www.mailslurp.com/smtp/python-send-email-smtp/)
- [SMTP access details](https://www.mailslurp.com/guides/smtp-imap/)
## Get started
This section describes how to get up and running with the Python client.
See the [examples page](https://www.mailslurp.com/examples/) for more examples and use with common frameworks such as Django, Flask and Pytest.
See the method documentation for a [list of all functions](https://python.mailslurp.com/) or jump to common controllers below:
- [InboxController](https://python.mailslurp.com/api/inbox_controller_api.html)
- [EmailController](https://python.mailslurp.com/api/email_controller_api.html)
- [SMSController](https://python.mailslurp.com/api/sms_controller_api.html)
- [WaitForController](https://python.mailslurp.com/api/wait_for_controller_api.html)
### Create API Key
First you'll need an API Key. [Create a free account](https://app.mailslurp.com) and copy the key from your dashboard.
### Install package
MailSlurp has an official PyPI package called `mailslurp-client`. It supports Python version 2 and 3.
```bash
pip install mailslurp-client
```
On some systems you may need to install `distutils`. If you encounter a `CERTIFICATE_VERIFY_VALID` error you can install `certifi` and `certifi-win32` for Windows:
```bash
pip install python-certifi-win32
```
### Configure
Once installed you can import `mailslurp_client` and create a [configuration](https://python.mailslurp.com/configuration.html) with your [API Key](https://app.mailslurp.com).
```python
import mailslurp_client
configuration = mailslurp_client.Configuration()
configuration.api_key["x-api-key"] = YOUR_API_KEY
```
Then you can create API controller instances using the configuration:
```python
with mailslurp_client.ApiClient(configuration) as api_client:
api_instance = mailslurp_client.InboxControllerApi(api_client)
```
See the [controllers overview](https://python.mailslurp.com/api/index.html) for all API methods.
## Email usage examples
MailSlurp can be used to create email addresses than can send and receive real emails, SMS, and attachments in Python.
### Create an email address
Create an inbox using the inbox controller:
```python
inbox_controller = mailslurp_client.InboxControllerApi(api_client)
inbox = inbox_controller.create_inbox_with_defaults()
self.assertTrue("@mailslurp" in inbox.email_address)
```
You can pass options using the `CreateInboxOptions` class:
```python
options = mailslurp_client.CreateInboxDto()
options.name = "Test inbox"
options.inbox_type = "SMTP_INBOX"
inbox = inbox_controller.create_inbox_with_options(options)
self.assertTrue("@mailslurp" in inbox.email_address)
```
See the [inbox controller](https://python.mailslurp.com/api/inbox_controller_api.html) for more methods.
### Access inbox using SMTP
```python
smtp_access = inbox_controller.get_imap_smtp_access(inbox_id=inbox.id)
self.assertIsNotNone(smtp_access.secure_smtp_server_host)
```
### Send with SMTP client
```python
# configure smtp client using access details
from smtplib import SMTP
with SMTP(
host=smtp_access.secure_smtp_server_host,
port=smtp_access.secure_smtp_server_port,
) as smtp:
msg = "Subject: Test subject
This is the body"
smtp.login(
user=smtp_access.secure_smtp_username,
password=smtp_access.secure_smtp_password,
)
smtp.sendmail(
from_addr=inbox.email_address,
to_addrs=[inbox.email_address],
msg=msg,
)
smtp.quit()
```
### List inboxes
List inboxes using the [inbox controller](https://python.mailslurp.com/api/inbox_controller_api.html):
```python
inboxes = inbox_controller.get_all_inboxes(page=0)
# pagination properties
self.assertTrue(inboxes.total_pages > 0)
self.assertTrue(inboxes.total_elements > 0)
# view contents
self.assertIsNotNone(inboxes.content[0].email_address)
```
### Get an inbox
```python
inbox = inbox_controller.get_inbox(inbox_id=inbox.id)
self.assertTrue("@mailslurp" in inbox.email_address)
# get by email address
inbox_by_email = inbox_controller.get_inbox_by_email_address(
inbox.email_address
)
self.assertTrue(inbox_by_email.exists)
# get by name
inbox_by_name = inbox_controller.get_inbox_by_name(inbox.name)
self.assertTrue(inbox_by_name.exists)
```
### Delete an inbox
```python
inbox_controller.delete_inbox(inbox_id=inbox.id)
```
### Upload attachments
To send attachments first upload the attachments as base64 encoded strings and use the returned attachment IDs when sending.
```python
import base64
attachment_controller = mailslurp_client.AttachmentControllerApi(api_client)
options = mailslurp_client.UploadAttachmentOptions(
filename="test.txt",
content_type="text/plain",
base64_contents=base64.b64encode("Hello world".encode("utf-8")).decode(
"utf-8"
),
)
attachment_ids = attachment_controller.upload_attachment(options)
self.assertTrue(len(attachment_ids) == 1)
```
### Send emails
Send emails with the [inbox controller](https://python.mailslurp.com/api/inbox_controller_api.html):
```python
send_options = mailslurp_client.SendEmailOptions(
to=[recipient.email_address],
subject="Hello",
body="Here is your email body",
attachments=attachment_ids,
)
sent = inbox_controller.send_email_and_confirm(
inbox_id=inbox.id, send_email_options=send_options
)
self.assertTrue(sent.sent_at is not None)
```
### Receive emails and extract content
Use the [wait for controller](https://python.mailslurp.com/api/wait_for_controller_api.html) to wait for an expected email count to be satisfied and then return those emails.
```python
wait_for_controller = mailslurp_client.WaitForControllerApi(api_client)
email = wait_for_controller.wait_for_latest_email(
inbox_id=inbox.id, timeout=60_000, unread_only=True
)
self.assertTrue("Hello" in email.subject)
```
### Email content matching
```python
matching_emails = wait_for_controller.wait_for_matching_emails(
inbox_id=inbox.id,
timeout=60_000,
unread_only=False,
match_options=mailslurp_client.MatchOptions(
conditions=[
mailslurp_client.ConditionOption(
condition="HAS_ATTACHMENTS", value="TRUE"
)
],
matches=[
mailslurp_client.MatchOption(
field="SUBJECT", should="CONTAIN", value="Hello"
)
],
),
count=1,
)
self.assertTrue(len(matching_emails) > 0)
```
### Download attachments
```python
attachment_content = attachment_controller.download_attachment_as_base64_encoded(email.attachments[0])
attachment_metadata = attachment_controller.get_attachment_info(email.attachments[0])
self.assertEqual(attachment_metadata.content_type, "text/plain")
```
### Fetch email by ID
```python
email_controller = mailslurp_client.EmailControllerApi(api_client)
email = email_controller.get_email(email_id=email_id)
self.assertTrue("Hello" in email.subject)
```
### Verify email address
You can verify email addresses with MailSlurp. This will perform SMTP queries for the email address on your behalf.
```python
def test_validate_email(self):
with mailslurp_client.ApiClient(configuration) as api_client:
mailserver_controller = mailslurp_client.MailServerControllerApi(api_client)
verify_options = mailslurp_client.VerifyEmailAddressOptions(email_address="test@gmail.com")
result = mailserver_controller.verify_email_address(verify_options=verify_options)
assert result.error is None
assert result.is_valid is True
```
## SDK Documentation
See the [guides page](https://www.mailslurp.com/guides/) or [the examples](https://www.github.com/mailslurp/examples) or the [Method Documentation](https://python.mailslurp.com/) for full usage.
نیازمندی
| مقدار | نام |
|---|---|
| - | urllib3>=1.15 |
| - | six>=1.10 |
| - | certifi |
| - | python-dateutil |
نحوه نصب
نصب پکیج whl mailslurp-client-9.0.0:
pip install mailslurp-client-9.0.0.whl
نصب پکیج tar.gz mailslurp-client-9.0.0:
pip install mailslurp-client-9.0.0.tar.gz