Skip to main content

This is an asynchronous Gmail client that can send emails currently.

Quickstart

import asyncio
import logging
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

import aiogmailsender

async def arun():
    sender = await aiogmailsender.create('<gmailusername>',
                                         '<gamilpassword>',
                                         rate_limit=60, # How many emails sender sends within a minute
                                         pool_size=2, # How many clients are kept in pool
                                         retry=5, # How many times sender retries to send a message, when sending fails
                                         backoff=30, # How long sender sleep before retry (unit. seconds)
                                         backoff_limit=300 # Max backoff (everytime sender retries, the backoff time increases exponentially and the time can't be over this limit.)
                                         )

    tasks = []
    for i in range(10):
        message = MIMEMultipart('alternative')
        message["From"] = 'test'
        message["To"] = '<targetemail>'
        message["Subject"] = f'test {i}'

        part = MIMEText('test', 'html')
        message.attach(part)
        tasks.append(sender.send(message))

    await asyncio.gather(*tasks)


if __name__ == '__main__':
    logging.basicConfig(format="%(asctime)s %(levelname)s:%(name)s:%(message)s", level=logging.DEBUG)
    asyncio.run(arun())

Release files for aiogmailsender 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiogmailsender 0.0.3
File Size Uploaded
aiogmailsender-0.0.3.tar.gz 4.1 kB Details

Release files / aiogmailsender-0.0.3.tar.gz

Download URL aiogmailsender-0.0.3.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
634a575fe34af498c1303e843a6158aab42de78ac293dffa52a09b99085b3119
BLAKE2b-256 checksum
How to use checksums
42259fb66f95efbd474f8dde269284068decb0e437d9d379858dac583212c22e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page