def send_mail(from_addr, to_addr, subject, body):
    cmdline = ['/usr/sbin/sendmail', '-f']
cmdline.append(from_addr)
cmdline.append(to_addr)
mailer = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess
    .PIPE)
dialog = """From: %s
To: %s
Subject: %s

%s
.
""" % (from_addr, to_addr,
    subject, body)
Django sending email