import smtplib

def dosend(fr,to,name,passwd):
    print fr,to,name,passwd   
    sub="User credentials for kasc-wg3"
    mess="""Dear member of KASC-WG3.

As you certainly remember we promised to send details about the new KASC-WG3 wiki. This email contains your personal password and username (see below). 
The wiki page has been set-up to stimulate discussions and collaborations, and everybody is invited to share ideas, comments, remarks and post questions to the community. 


Writing a contribution for the first time, might be challenging. For a brief introduction on how to edit a page, once you are logged in, please follow the link in the left column  "PMWIKI FAQ" and then click on the "BASIC PMWIKI EDITING RULES". 

You can reach the KASC-WG3 wiki with following url:

http://kasc-wg3.phys.au.dk/

user credentials are:
login: %s
password: %s


In order to enhance collaboration we decided to have a brief user profile, which can be found in the rubric 'MEMBERS'. We of course know that you are all very busy, but we nevertheless, kindly ask you to take few minutes and fill in the form.

If you experience any trouble please contact Vichi antoci (antoci@phys.au.dk). 

Enjoy!
your KASC-WG3 team
""" %(name,passwd)

    FROM=fr
    TO=to
    SUBJECT=sub
    TEXT=mess
    message = """\
From: %s
To: %s
Subject: %s

%s
""" % (FROM, TO, SUBJECT, TEXT)
    server = smtplib.SMTP('10.3.0.1')
    print message
    server.sendmail(fr,[to],message)
    server.quit()

#dosend('ew@phys.au.dk',['ew@phys.au.dk'],'subject','hallo')
f=open("passwords.do")
for a in f:
	b= a.rstrip()
	#print b.split(" ")
	(user,email,passw)=b.split(" ")
#	print user
	dosend ( "antoci@phys.au.dk",email,user,passw)

