A Good Mailer

Nick Stinemates nick at stinemates.org
Wed Nov 18 17:30:41 EST 2009


On Wed, Nov 18, 2009 at 03:27:11PM -0400, Victor Subervi wrote:
> Hi;
> I need a good mailer that will enable me to mail email from web forms.

smtplib

> Suggestions?

silly example..

#!/usr/bin/env python
import smtplib

session = smtplib.SMTP("localhost")
username = "abc"
password = "def"
session.login(username, password) # only if it requires auth

subject = "Hello, "

header = "Subject: %s \r\nContent-type: text/html;
charset=utf-8\r\n\r\n"

message = "world!"

email_from = "victor at is.awesome"
email_to = ["email at myhost.com"]

session.sendmail(email_from, email_to, header+messages)

HTH,
Nick Stinemates


> TIA,
> Victor

> -- 
> http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list