mailer

raw JSON →
0.8.1 verified Fri May 01 auth: no python deprecated

A simple Python module to send email messages. Current version 0.8.1, last updated in 2011. No longer actively maintained; use in legacy projects only.

pip install mailer==0.8.1
error AttributeError: module 'mailer' has no attribute 'Mailer'
cause Incorrect import: using `import mailer` then `mailer.Mailer`.
fix
Use from mailer import Mailer instead.
error smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted')
cause Modern Gmail requires App Passwords or OAuth; mailer sends plain password.
fix
Switch to yagmail with OAuth or generate an App Password for the SMTP server.
deprecated mailer 0.8.1 is over a decade old; no support for modern TLS/SSL or authentication. Use smtplib from stdlib or yagmail for modern email.
fix Migrate to yagmail or smtplib.
gotcha The login method does not support password-less authentication or OAuth. Only plain password.
fix Use a dedicated library like yagmail for Gmail OAuth.

Send a plain text email via SMTP.

from mailer import Mailer, Message

mailer = Mailer('smtp.example.com')
mailer.login('user@example.com', 'password')
msg = Message(From='from@example.com', To='to@example.com', Subject='Hello', Body='World')
mailer.send(msg)