1 # Copyright (C) 2004-2012 Aaron Swartz
6 # Lindsey Smith <lindsey.smith@gmail.com>
8 # Martin 'Joey' Schulze
10 # W. Trevor King <wking@tremily.us>
12 # This file is part of rss2email.
14 # rss2email is free software: you can redistribute it and/or modify it under
15 # the terms of the GNU General Public License as published by the Free Software
16 # Foundation, either version 2 of the License, or (at your option) version 3 of
19 # rss2email is distributed in the hope that it will be useful, but WITHOUT ANY
20 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
21 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License along with
24 # rss2email. If not, see <http://www.gnu.org/licenses/>.
26 """Per-user rss2email configuration
29 import collections as _collections
30 import configparser as _configparser
32 import html2text as _html2text
35 class Config (_configparser.ConfigParser):
36 def __init__(self, **kwargs):
37 super(Config, self).__init__(dict_type=_collections.OrderedDict)
39 def _setup(self, section='DEFAULT'):
40 _html2text.UNICODE_SNOB = self.getboolean(
41 section, 'unicode-snob', fallback=False)
42 _html2text.LINKS_EACH_PARAGRAPH = self.getboolean(
43 section, 'links-after-each-paragaph', fallback=False)
44 _html2text.BODY_WIDTH = self.getint(section, 'body-width', fallback=0)
49 # setup defaults for feeds that don't customize
50 CONFIG['DEFAULT'] = _collections.OrderedDict((
52 # The email address messages are from by default
53 ('from', 'user@rss2email.invalid'),
54 # True: Only use the 'from' address.
55 # False: Use the email address specified by the feed, when possible.
56 ('force-from', str(False)),
57 # True: Use the publisher's email if you can't find the author's.
58 # False: Just use the 'from' email instead.
59 ('use-publisher-email', str(False)),
60 # Only use the feed email address rather than friendly name
62 ('friendly-name', str(True)),
63 # Set this to default To email addresses.
67 # Set an HTTP proxy (e.g. 'http://your.proxy.here:8080/')
69 # Set the timeout (in seconds) for feed server response
70 ('feed-timeout', str(60)),
73 # True: Fetch, process, and email feeds.
74 # False: Don't fetch, process, or email feeds
75 ('active', str(True)),
76 # True: Generate Date header based on item's date, when possible.
77 # False: Generate Date header based on time sent.
78 ('date-header', str(False)),
79 # A comma-delimited list of some combination of
80 # ('issued', 'created', 'modified', 'expired')
81 # expressing ordered list of preference in dates
82 # to use for the Date header of the email.
83 ('date-header-order', 'modified, issued, created, expired'),
84 # Set this to add bonus headers to all emails
85 # Example: bonus-header = 'Approved: joe@bob.org'
87 # True: Receive one email per post.
88 # False: Receive an email every time a post changes.
89 ('trust-guid', str(True)),
90 # To most correctly encode emails with international
91 # characters, we iterate through the list below and use the
92 # first character set that works.
93 ('encodings', 'US-ASCII, ISO-8859-1, UTF-8, BIG5, ISO-2022-JP'),
95 # True: Send text/html messages when possible.
96 # False: Convert HTML to plain text.
97 ('html-mail', str(False)),
98 # Optional CSS styling
99 ('use-css', str(False)),
102 ' font: 18pt Georgia, "Times New Roman";\n'
105 ' font: 12pt Arial;\n'
108 ' font: 12pt Arial;\n'
109 ' font-weight: bold;\n'
113 ' font-family: monospace;\n'
116 ' background: #e0ecff;\n'
117 ' border-bottom: solid 4px #c3d9ff;\n'
119 ' margin-top: 0px;\n'
123 ' font-size: 20px;\n'
124 ' text-decoration: none;\n'
127 ' background: #c3d9ff;\n'
128 ' border-top: solid 4px #c3d9ff;\n'
130 ' margin-bottom: 0px;\n'
133 ' border: solid 4px #c3d9ff;\n'
136 ' margin-left: 5px;\n'
137 ' margin-right: 5px;\n'
140 # Use Unicode characters instead of their ascii psuedo-replacements
141 ('unicode-snob', str(False)),
142 # Put the links after each paragraph instead of at the end.
143 ('links-after-each-paragraph', str(False)),
144 # Wrap long lines at position. 0 for no wrapping.
145 ('body-width', str(0)),
148 # True: Use SMTP_SERVER to send mail.
149 # False: Call /usr/sbin/sendmail to send mail.
150 ('use-smtp', str(False)),
151 ('smtp-server', 'smtp.yourisp.net:25'), ('smtp-auth', str(False)), # set to True to use SMTP AUTH
152 ('smtp-username', 'username'), # username for SMTP AUTH
153 ('smtp-password', 'password'), # password for SMTP AUTH
154 ('smtp-ssl', str(False)), # Connect to the SMTP server using SSL
157 # Verbosity (one of 'error', 'warning', 'info', or 'debug').
158 ('verbose', 'warning'),