{"id":27292,"library":"pyramid-mailer","title":"pyramid_mailer","description":"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.","status":"maintenance","version":"0.15.1","language":"python","source_language":"en","source_url":"https://github.com/Pylons/pyramid_mailer","tags":["pyramid","email","mailer","smtp"],"install":[{"cmd":"pip install pyramid-mailer","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Required framework","package":"pyramid","optional":false},{"reason":"Email delivery backend","package":"repoze.sendmail","optional":false}],"imports":[{"note":"Mailer is the core class to send emails.","symbol":"Mailer","correct":"from pyramid_mailer.mailer import Mailer"},{"note":"Message is in the message submodule.","wrong":"from pyramid_mailer import Message","symbol":"Message","correct":"from pyramid_mailer.message import Message"}],"quickstart":{"code":"from pyramid.config import Configurator\nfrom pyramid_mailer.mailer import Mailer\nfrom pyramid_mailer.message import Message\n\nconfig = Configurator()\n# Configure mailer (e.g., default mail.host via ini file or override)\nconfig.include('pyramid_mailer')\n\n# In a view callable:\nrequest = config.registry['request']  # Example\nmailer = Mailer(request)\nmsg = Message(subject='Hello',\n              sender='from@example.com',\n              recipients=['to@example.com'],\n              body='Test email')\nmailer.send(msg)","lang":"python","description":"Basic usage of pyramid_mailer: create a Mailer from a request, construct a Message, and send."},"warnings":[{"fix":"Always provide a 'sender' parameter (email string) when creating a Message.","message":"The Message class requires the 'sender' argument; it's not optional. Many users forget to set it and get a TypeError.","severity":"gotcha","affected_versions":"all"},{"fix":"Wrap mailer.send in try/except or configure logging to capture backend exceptions.","message":"Mailer.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.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider switching to a more modern alternative like mailjet, sendgrid, or use smtplib directly.","message":"pyramid_mailer uses repoze.sendmail which has been unmaintained and may have issues with newer Python versions or TLS/SSL configurations.","severity":"deprecated","affected_versions":"0.15.x"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from pyramid_mailer.message import Message' instead of 'from pyramid_mailer import Message'.","cause":"Importing Message from the wrong path. The correct import is from pyramid_mailer.message import Message.","error":"AttributeError: module 'pyramid_mailer' has no attribute 'Message'"},{"fix":"Provide a 'sender' argument, e.g., Message(subject='...', sender='me@example.com', ...).","cause":"The Message constructor requires a 'sender' argument to be passed.","error":"TypeError: __init__() missing 1 required positional argument: 'sender'"},{"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.","cause":"The SMTP server is not reachable or the host/port configuration is incorrect (defaults to localhost:25).","error":"ConnectionRefusedError: [Errno 111] Connection refused"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}