Database Reference
In-Depth Information
recipients_list = [r.strip() for r
in
recipients.split(',')]
server = smtplib.SMTP(smtp_server)
server.sendmail(sender_address,
recipients_list, msg)
server.quit()
$$ LANGUAGE plpythonu;
This function formats a message ( msg = "" ), converts a comma-separated To:
address into a list of e-mail addresses ( recipients_list = [r.strip()... ),
connects to a SMTP server, and then passes the message to the SMTP server for
delivery.
To use this function in a production system, it would probably require a bit more
checking on the formats and some extra error handling in case something goes
wrong. You can read more about Python's smtplib at http://docs.python.org/library/
smtplib.html .
Search WWH ::




Custom Search