26 |
26 |
27 If :attr:`~iro.offer.provider.Provider.testmode` is **True** no mail will be send, only a connection is created to server. |
27 If :attr:`~iro.offer.provider.Provider.testmode` is **True** no mail will be send, only a connection is created to server. |
28 |
28 |
29 """ |
29 """ |
30 def __init__(self, name): |
30 def __init__(self, name): |
31 Provider.__init__(self,name,{"mail":[None]}) |
31 options = [ |
32 self.options.update({ |
32 ("host", Option(lambda x,y: x, long="Hostname of MTA", must=True)), |
33 "send_from":Option(vEmail,long="Emailaddress from which mail will be sended.",must=True), |
33 ("port", Option(partial(vInteger,minv=0),long="Port of the MTA", default=25)), |
34 "host":Option(lambda x,y:x, long="Hostname of MTA", must=True), |
34 ("user", Option(lambda x,y: x, long="username to login into MTA.",default="")), |
35 "port":Option(partial(vInteger,minv=0),long="Port of the MTA", default=25), |
35 ("password", Option(lambda x,y: x, long="password to login into MTA.",default="")), |
36 "user":Option(lambda x,y:x, long="username to login into MTA.",default=""), |
36 ("SSL", Option(vBool,long="use SSL for connection to MTA", default=False)), |
37 "password":Option(lambda x,y:x, long="password to login into MTA.",default=""), |
37 ("TLS", Option(vBool,long="use TLS for connection to MTA", default=False)), |
38 "SSL":Option(vBool,long="use SSL for connection to MTA", default=False), |
38 ("send_from", Option(vEmail,long="Emailaddress from which mail will be sended.",must=True)), |
39 "TLS":Option(vBool,long="use TLS for connection to MTA", default=False), |
39 ] |
40 }) |
40 Provider.__init__(self,name,{"mail":[None]},options) |
41 self.order.extend(["host","port","user","password","SSL","TLS","send_from"]) |
|
42 |
41 |
43 def send(self, recipient, mail): |
42 def send(self, recipient, mail): |
44 """sends a mail to recipient |
43 """sends a mail to recipient |
45 |
44 |
46 :param string recipient: A valid email address. |
45 :param string recipient: A valid email address. |