On Aug 29, 11:44 am, [EMAIL PROTECTED] wrote: > On Aug 28, 3:23 pm, gordyt <[EMAIL PROTECTED]> wrote: > > > > > Peter here is an example. I just tried it and it works fine. > > > from smtplib import SMTP > > HOST = "smtp.gmail.com" > > PORT = 587 > > ACCOUNT = "" # put your gmail email account name here > > PASSWORD = "" # put your gmail email account password here > > > def send_email(to_addrs, subject, msg): > > server = SMTP(HOST,PORT) > > server.set_debuglevel(1) # you don't need this > > server.ehlo() > > server.starttls() > > server.ehlo() > > server.login(ACCOUNT, PASSWORD) > > server.sendmail(ACCOUNT, to_addrs, > > """From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s\r\n.\r\n""" % ( > > ACCOUNT, ",".join(to_addrs), subject, msg > > ) > > ) > > server.quit() > > > if __name__ == "__main__": > > send_email( ['[EMAIL PROTECTED]'], 'this is just a test', > > "hello world!" ) > > Thanks to everyone who's replied. gordyt, I didn't dare dream anyone > would hand me fully functional source code, so thank you very much for > that. Unfortunately, it doesn't work for me, likely because of some > complication from my company's firewall. > > All things considered, going through Gmail is an unnecessary step if I > can run a server on my own PC. Is there any hope of this working? Can > it be done easily? Is there anything I should know about the > SMTPServer object, and are there any other modules I'd need? > > Thanks again for all the help.
I would recommend looking at the email module too as it is a little bit more flexible: http://docs.python.org/lib/module-email.html You could also see how I do it in wxPython: http://www.blog.pythonlibrary.org/?p=38 My script is Windows only at the moment. Mike -- http://mail.python.org/mailman/listinfo/python-list