17 import ConfigParser |
17 import ConfigParser |
18 import logging |
18 import logging |
19 logger=logging.getLogger("SMTP") |
19 logger=logging.getLogger("SMTP") |
20 |
20 |
21 class SMTP(): |
21 class SMTP(): |
22 def __init__(self,config_filename=None,section="smtp"): |
22 def __init__(self,config_filenames=None,section="smtp"): |
23 self.config_filename=config_filename |
23 self.config_filenames=config_filenames |
24 self.section=section |
24 self.section=section |
25 self.bStart=False |
25 self.bStart=False |
26 self.bTLS=False |
26 self.bTLS=False |
27 self.bSSL=False |
27 self.bSSL=False |
28 self.max_recipients=1 |
28 self.max_recipients=1 |
29 |
29 |
30 |
30 |
31 def read_basic_config(self,config_filename=None): |
31 def read_basic_config(self,config_filenames=None): |
32 """Read basic options from the config file""" |
32 """Read basic options from the config file""" |
33 if not (config_filename is None): |
33 if not (config_filenames is None): |
34 self.config_filename=config_filename |
34 self.config_filenames=config_filenames |
35 |
35 |
36 cp = ConfigParser.ConfigParser() |
36 cp = ConfigParser.ConfigParser() |
37 cp.read([self.config_filename]) |
37 cp.read(self.config_filenames) |
38 self.config_parser = cp |
38 self.config_parser = cp |
39 self.send_from=cp.get(self.section, 'send_from') |
39 self.send_from=cp.get(self.section, 'send_from') |
40 self.host=cp.get(self.section, 'host') |
40 self.host=cp.get(self.section, 'host') |
41 self.port=cp.get(self.section, 'port') |
41 self.port=cp.get(self.section, 'port') |
42 self.user=cp.get(self.section, 'user') |
42 self.user=cp.get(self.section, 'user') |