Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

An extension of standard smtplib, which supports proxy tunneling

Project description

An extension of standard smtplib, which supports proxy tunneling.

Package works on Python 2.7+ and Python 3.5+.

Using PySocks.

Installation

You can install xsmtplib from PyPI by running:

pip install xsmtplib

Or you can just download tarball / clone the repository and run:

python setup.py install

Alternatively, include just xsmtplib.py in your project.

Usage

xsmtplib extends standard python smtplib, so it can be used instead without any compatibility issues.

Connection to SMTP server via proxy can be done during instance initialization:

from xsmtplib import SMTP

server = SMTP(host="smtp.example.com", proxy_host="proxy.example.com")
server.sendmail("user@example.com", "admin@example.com", "I have an issue. Please help!")
server.quit()

Alternatively, you can connect to SMTP server manually when you need to:

from xsmtplib import SMTP

server = SMTP(timeout=30)
server.set_debuglevel(1)
server.connect_proxy(proxy_host="proxy.example.com", host="smtp.example.com")
server.helo("user@example.com")
server.sendmail("user@example.com", "admin@example.com", "I have an issue. Please help!")
s.quit()

Known issues

SMTPS (SSL SMTP) and LMTP connections via proxy are not supported yet.

License

See LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
xsmtplib-1.0.0.dev1.tar.gz (16.4 kB) Copy SHA256 hash SHA256 Source None Jul 30, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page