A Windows-only Python library for sending emails through locally installed Microsoft Outlook using win32 COM.
Project description
winoutlook
Overview
winoutlook is a Windows-only Python library for sending emails through locally installed Microsoft Outlook using the win32 COM interface. It provides a simple command-line interface (CLI) to send emails directly from your Python scripts or command line.
Features
- Send Emails: Easily send emails with plain text or HTML content.
- Attachments: Attach multiple files to your emails.
- Multiple Accounts: Specify which Outlook account to use for sending emails.
- Sender Name: Send emails on behalf of a different sender name.
Installation
Using pip
You can install winoutlook via pip:
pip install winoutlook
Requirements
- Python 3.13 or later
- Microsoft Outlook installed on your Windows machine
Usage
Command-Line Interface (CLI)
The winoutlook library comes with a CLI tool called wosend that you can use to send emails directly from the command line.
wosend -t recipient@example.com -s "Subject Here" -b "This is the body of the email."
Options
-t, --to: Recipient email address (required).-s, --subject: Email subject (required).-b, --body: Email body text (default is empty).-f, --html: Send email as HTML (default is plain text).-a, --attach: Attach files to the email (e.g.,-a file1.pdf file2.docx).-u, --use-account: Specify the Outlook account to use (default is the default account).-n, --use-name: Specify the sender name (default is the account name).
Python API
You can also use winoutlook directly in your Python scripts.
from winoutlook.mailer import Mailer
Mailer.send_email(
recipient='recipient@example.com',
subject='Subject Here',
body='This is the body of the email.',
html_format=False,
attachments=['file1.pdf', 'file2.docx'],
send_using_account='youraccount@example.com',
sent_on_behalf_of_name='Your Name',
)
Parameters
recipient: Recipient email address (required).subject: Email subject (required).body: Email body text (default is empty).html_format: Send email as HTML (default is plain text).attachments: List of file paths to attach (default is none).send_using_account: Specify the Outlook account to use (default is the default account).sent_on_behalf_of_name: Specify the sender name (default is the account name).
Examples
Sending a Plain Text Email
wosend -t recipient@example.com -s "Hello" -b "This is a test email."
Sending an HTML Email
wosend -t recipient@example.com -s "Hello" -b "<h1>This is a test email.</h1>" -f
Sending an Email with Attachments
wosend -t recipient@example.com -s "Hello" -b "Please find the attached files." -a file1.pdf file2.docx
Sending an Email Using a Specific Account
wosend -t recipient@example.com -s "Hello" -b "This is a test email." -u youraccount@example.com
Sending an Email on Behalf of Someone Else
wosend -t recipient@example.com -s "Hello" -b "This is a test email." -n "Your Name"
License
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
Contact
For any questions or support, please contact the maintainer:
- Name: randomseed42
- Email: randomseed42@protonmail.com
Acknowledgments
- Thanks to the pywin32 project for providing the necessary tools to interact with the win32 COM interface.
- Special thanks to the email-validator library for email validation.
Changelog
- v0.1.0: Initial release with basic email sending functionality.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file winoutlook-0.1.0.tar.gz.
File metadata
- Download URL: winoutlook-0.1.0.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
555503e42102a2cd3b1510f5cb42c9b4362f041c7d6886badf846755fa62c030
|
|
| MD5 |
8ef43a6ef8f4c93cd53d00f012a9b3a5
|
|
| BLAKE2b-256 |
ef8f11152b0eef32e16d189e15242788d7939abdaaa7dc443479bc622383395c
|
File details
Details for the file winoutlook-0.1.0-py3-none-any.whl.
File metadata
- Download URL: winoutlook-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3329bfc027ba614e507889eff3f83bf27aafb9a4a6fb7e2f8657338ff2d8211a
|
|
| MD5 |
cb31b0aed5e5b2b17dc851d055942b0f
|
|
| BLAKE2b-256 |
ab8b9088041d9c9e35ba81a6243430967dd69627012048750488367a219f54af
|