February 3rd, 2005, 07:44 PM
I wrote a simple email function for an article a while that you might be interested in. You can find out more the function here:
def mail(address, subject, message, host = 'localhost'):
headers = 'From: %srnTo: %srnSubject: %srnrn%s'
message = headers % (address, ','.join(address[1:]), subject, message)
server = smtplib.SMTP(host)
server.sendmail(address, address[1:], message)
if __name__ == '__main__':
mail(('firstname.lastname@example.org', 'email@example.com'), 'subject', 'message')
Anyway assuming that you want to send the data in the file, rather than the file itself (as an attachment) it should be pretty straight forward; read() the data into your program and send that data as the message. If you do want to attach a file it's a little more difficult.
In any case I would recommend that you check out the documentation for the email and smtplib modules for more information:
Hope this helps,
programming language development: www.netytan.com – Hula