{"id":24517,"library":"repoze-sendmail","title":"repoze.sendmail","description":"A Python library for sending email via SMTP or a queued delivery mechanism. Provides a transaction-aware mail delivery interface with support for multiple delivery modes. Current version 4.4.1, stable but infrequently updated.","status":"active","version":"4.4.1","language":"python","source_language":"en","source_url":"https://github.com/repoze/repoze.sendmail","tags":["email","smtp","transaction","queue","mail","python3"],"install":[{"cmd":"pip install repoze.sendmail","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Required for transactional email delivery","package":"transaction","optional":false},{"reason":"Required for package metadata and entry points","package":"setuptools","optional":true}],"imports":[{"note":"mailer_factory is not the correct top-level import; use delivery classes.","wrong":"from repoze.sendmail import mailer_factory","symbol":"mailer_factory","correct":"from repoze.sendmail.delivery import DirectMailDelivery"},{"note":"Queue mechanism is under delivery module, not queued.","wrong":"from repoze.sendmail.queued import QueuedMailDelivery","symbol":"QueuedMailDelivery","correct":"from repoze.sendmail.delivery import QueuedMailDelivery"}],"quickstart":{"code":"from repoze.sendmail.delivery import DirectMailDelivery\nfrom repoze.sendmail.mailer import SMTPMailer\n\nmailer = SMTPMailer(hostname='localhost', port=25)\ndelivery = DirectMailDelivery(mailer)\nfrom_addr = 'sender@example.com'\nto_addrs = ['recipient@example.com']\nmsg = b'Subject: Test\\n\\nHello!'\ndelivery.send(from_addr, to_addrs, msg)","lang":"python","description":"Sends an email directly via SMTP using DirectMailDelivery and SMTPMailer."},"warnings":[{"fix":"Update imports: from repoze.sendmail.mailer import SMTPMailer instead of the old alias.","message":"In version 4.0, the import path for mailer classes changed. The old repoze.sendmail.mailer module was split into separate classes.","severity":"breaking","affected_versions":"<4.0"},{"fix":"Replace mailer_factory calls with explicit delivery class instantiation.","message":"The use of the 'mailer_factory' function is deprecated. Use DirectMailDelivery or QueuedMailDelivery directly.","severity":"deprecated","affected_versions":">=4.0"},{"fix":"Ensure you have a transaction manager (e.g., Zope or pyramid_tm) when using QueuedMailDelivery.","message":"The library requires the 'transaction' package for queued delivery. If you don't use a transaction manager, the message may not be delivered until the transaction commits.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from repoze.sendmail.delivery import ...'","cause":"Incorrect import path. The module is 'repoze.sendmail.delivery', not 'repoze.sendmail.delivery' (yes it's confusing).","error":"AttributeError: module 'repoze.sendmail' has no attribute 'delivery'"},{"fix":"Add: 'from repoze.sendmail.mailer import SMTPMailer'","cause":"Forgot to import SMTPMailer from the correct submodule.","error":"NameError: name 'SMTPMailer' is not defined"},{"fix":"Build the message as a bytes object or email message and pass it as the third argument.","cause":"The send method expects (from_addr, to_addrs, message). You may have passed an extra argument like subject as separate.","error":"TypeError: send() takes 3 positional arguments but 4 were given"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}