3 def ReadConfig(filename
):
4 """ read param from config file: filename """
5 rc
=ConfigParser
.ConfigParser()
7 maxlen
=rc
.getint('global','maillen')
8 smtpcount
=rc
.getint('global','smtp')
9 defaultsmtp
=rc
.get('global','default')
11 param
.append([maxlen
,smtpcount
])
13 for i
in xrange(1,smtpcount
+1):
15 key
=rc
.get(sname
,'name')
16 addr
=rc
.get(sname
,'addr')
17 port
=rc
.getint(sname
,'port')
18 ssl
=rc
.getint(sname
,'ssl')
19 username
=rc
.get(sname
,'user')
20 password
=rc
.get(sname
,'pass')
21 smpts
[key
]=[addr
,port
,ssl
,username
,password
]
27 cf
=ConfigParser
.ConfigParser()
28 cf
.read('/home/rui/.xmailrc')
29 cf
.get("global","maillen")
30 cf
.getint('smtp1','ssl')
31 cf
.getboolean('smtp1','ssl')
32 cf
.getfloat('global','maillen')
33 print cf
.getint('global','smtp')
35 print ReadConfig('/home/rui/.xmailrc')