Registry / communication / pyramid-mailer

pyramid-mailer

JSON →
library0.15.1pypypi✓ verified 86d ago

A library for sending email from Pyramid web applications. It wraps Python's smtplib and provides a simple API to send email messages with attachments, CC, BCC, and more. Version 0.15.1 is the latest release, but the project appears unmaintained since 2016.

pip install pyramid-mailer
INSTALL
IMPORT
SIG · PYRAMID-MAILER
P
pyramid-mailer
communicationpythonv0.15.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Mailer
from pyramid_mailer.mailer import Mailer
Mailer is the core class to send emails.
Message
from pyramid_mailer.message import Message
from pyramid_mailer import Message
Message is in the message submodule.

Basic usage of pyramid_mailer: create a Mailer from a request, construct a Message, and send.

from pyramid.config import Configurator from pyramid_mailer.mailer import Mailer from pyramid_mailer.message import Message config = Configurator() # Configure mailer (e.g., default mail.host via ini file or override) config.include('pyramid_mailer') # In a view callable: request = config.registry['request'] # Example mailer = Mailer(request) msg = Message(subject='Hello', sender='from@example.com', recipients=['to@example.com'], body='Test email') mailer.send(msg)
Debug
Known issues
gotchaThe Message class requires the 'sender' argument; it's not optional. Many users forget to set it and get a TypeError.
fix
Always provide a 'sender' parameter (email string) when creating a Message.
affects: all
gotchaMailer.send does not return a boolean or raise on failure; it delegates to the mailer backend (repoze.sendmail). Errors may be silently swallowed if the mail host is unreachable.
fix
Wrap mailer.send in try/except or configure logging to capture backend exceptions.
affects: all
deprecatedpyramid_mailer uses repoze.sendmail which has been unmaintained and may have issues with newer Python versions or TLS/SSL configurations.
fix
Consider switching to a more modern alternative like mailjet, sendgrid, or use smtplib directly.
affects: 0.15.x
Errors
Common errors & fixes
AttributeError: module 'pyramid_mailer' has no attribute 'Message'
Importing Message from the wrong path. The correct import is from pyramid_mailer.message import Message.
fix
Use 'from pyramid_mailer.message import Message' instead of 'from pyramid_mailer import Message'.
TypeError: __init__() missing 1 required positional argument: 'sender'
The Message constructor requires a 'sender' argument to be passed.
fix
Provide a 'sender' argument, e.g., Message(subject='...', sender='me@example.com', ...).
ConnectionRefusedError: [Errno 111] Connection refused
The SMTP server is not reachable or the host/port configuration is incorrect (defaults to localhost:25).
fix
Configure the correct SMTP host and port in your .ini file (e.g., mail.host = smtp.example.com, mail.port = 587) and ensure credentials are set if needed.
Upgrade
Version history
0.15.1latest on PyPI · released Dec 13, 2016
Audit
Dependencies
pyramidrequiredRequired framework
repoze.sendmailrequiredEmail delivery backend
Agent activity
23 hits · last 30 days
node
22
OpenAI (training)
1
Resources
pyramid-mailer — pip install pyramid-mailer · libregistry