1 # -*- coding: utf-8 -*-
4 # Suppose you want to spam your friend, and you have lots of
5 # friends. The solution is to write a program to do it. After a gander
6 # at python docs, one easily found the module for the job.
7 # see http://python.org/doc/2.3.4/lib/SMTP-example.html
9 # the code is a bit long with the command line, but the key lies at
10 # the bottom four lines. The gist is this:
12 ####### test: strings - nonsense code follows
22 smtpServer='smtp.yourdomain.com';
23 fromAddr='xah@xahlee.org';
24 toAddr='xah@xahlee.org';
25 text='''Subject: newfound love
29 long time no write, i have a new manifesto i
30 think it would be of interest for you to peruse.
34 server = smtplib.SMTP(smtpServer)
35 server.set_debuglevel(1)
36 server.sendmail(fromAddr, toAddr, text)
39 # save this file as x.py and run it.
40 # it should send out the mail.
42 # the set_debuglevel() is nice because you see all the interactions
43 # with the smtp server. Useful when you want to see what's going on