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