On Tue, 23 Jan 2007 17:25:24 GMT, py <[EMAIL PROTECTED]> wrote: >from smtplib import SMTP >from socket import sslerror #if desired >server = SMTP('smtp.gmail.com') >server.set_debuglevel(0) # or 1 for verbosity >server.ehlo('[EMAIL PROTECTED]') >server.starttls() >server.ehlo('[EMAIL PROTECTED]') # say hello again >server.login('[EMAIL PROTECTED]', 'yourpassword') ># i have a suspicion that smptlib does not add the required newline dot >newline so i do it myself >server.sendmail('[EMAIL PROTECTED]', '[EMAIL PROTECTED]', message_text + >'\n.\n') ># next line generates the ignorable socket.sslerror >server.quit() >
Or with Twisted: from twisted.internet.ssl import ClientContextFactory from twisted.internet.defer import Deferred from twisted.mail.smtp import ESMTPSenderFactory from twisted.internet import reactor contextFactory = ClientContextFactory() result = Deferred() factory = ESMTPSenderFactory('[EMAIL PROTECTED]', 'your password', '[EMAIL PROTECTED]', '[EMAIL PROTECTED]', messageText, contextFactory=contextFactory) reactor.connectTCP('smtp.gmail.com', 25, factory) result.addCallback(lambda ign: reactor.stop()) reactor.run() Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list