[lug] python script to send email via SMTP

Sean Reifschneider jafo at tummy.com
Tue Jul 17 20:28:40 MDT 2007


On Tue, Jul 17, 2007 at 11:21:20AM -0600, Michael J. Hammel wrote:
>I found the following script online.  I haven't learned Python yet, so I
>can't tell if it should work or not, but it seems to at least try to

The code in question seems to be fine, I've compared it to some simple
Python code I use to test SMTP AUTH and it seems to be the same code at
it's heart.

   import smtplib, sys, os

   if len(sys.argv) != 4:
      print ('usage: %s <host> <login> <password>'
            % os.path.basename(sys.argv[0] ))
      sys.exit(1)

   server = smtplib.SMTP(sys.argv[1])
   server.set_debuglevel(1)
   server.login(sys.argv[2], sys.argv[3])
   server.quit()

Sean
-- 
 "It is well to remember that the entire universe, with one trifling
 exception, is composed of others."  -- John Andrew Holmes
Sean Reifschneider, Member of Technical Staff <jafo at tummy.com>
tummy.com, ltd. - Linux Consulting since 1995: Ask me about High Availability




More information about the LUG mailing list