1 # -*- coding: utf-8 -*- |
|
2 #Copyright (C) 2009 Sandro Knauß <bugs@sandroknauss.de> |
|
3 |
|
4 #This program is free software; you can redistribute it and/or modify it under the terms |
|
5 #of the GNU General Public License as published by the Free Software Foundation; |
|
6 #either version 3 of the License, or any later version. |
|
7 #This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
|
8 #without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
9 #See the GNU General Public License for more details. |
|
10 |
|
11 #You should have received a copy of the GNU General Public License |
|
12 #along with this program; if not, see <http://www.gnu.org/licenses/>. |
|
13 |
|
14 from email.mime.text import MIMEText |
|
15 |
|
16 class content: |
|
17 def __init__(self,content): |
|
18 self.content=content |
|
19 |
|
20 def sendto(self,anbieter,recipients): |
|
21 pass |
|
22 |
|
23 class SMS(content): |
|
24 def __init__(self,cont): |
|
25 content.__init__(self,cont) |
|
26 |
|
27 def sendto(self,anbieter,recipients): |
|
28 anbieter.sendSMS(self,recipients) |
|
29 |
|
30 class FAX(content): |
|
31 def __init__(self,header,cont,attachments): |
|
32 content.__init__(self,cont) |
|
33 self.header=header |
|
34 self.attachments=attachments |
|
35 |
|
36 def sendto(self,anbieter,recipients): |
|
37 anbieter.sendFAX(self,recipients) |
|
38 |
|
39 class Mail(content): |
|
40 def __init__(self, subject, body): |
|
41 con=MIMEText(body) |
|
42 con['Subject']=subject |
|
43 content.__init__(self, con) |
|
44 |
|
45 def sendto(self,anbieter,recipients): |
|
46 anbieter.sendMail(self,recipients) |
|
47 |
|
48 def as_string(self): |
|
49 return self.content.as_string() |
|
50 |
|