summaryrefslogtreecommitdiffstats
path: root/askbot/conf/email.py
blob: db1fc813e47784ffced39a70607c8bd42c5ca424 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
"""
Email related settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION
from askbot.deps import livesettings
from askbot import const
from django.utils.translation import ugettext_lazy as _
from django.conf import settings as django_settings

EMAIL_SUBJECT_PREFIX = getattr(django_settings, 'EMAIL_SUBJECT_PREFIX', '')

EMAIL = livesettings.ConfigurationGroup(
            'EMAIL',
            _('Email and email alert settings'), 
            super_group = LOGIN_USERS_COMMUNICATION
        )

settings.register(
    livesettings.StringValue(
        EMAIL,
        'EMAIL_SUBJECT_PREFIX',
        default = EMAIL_SUBJECT_PREFIX,
        description = _('Prefix for the email subject line'),
        help_text = _(
                'This setting takes default from the django setting'
                'EMAIL_SUBJECT_PREFIX. A value entered here will override'
                'the default.'
            )
    )
)

settings.register(
    livesettings.BooleanValue(
        EMAIL,
        'ENABLE_EMAIL_ALERTS',
        default = True,
        description = _('Enable email alerts'),
    )
)

settings.register(
    livesettings.IntegerValue(
        EMAIL,
        'MAX_ALERTS_PER_EMAIL',
        default=7,
        description=_('Maximum number of news entries in an email alert')
    )
)

settings.register(
    livesettings.StringValue(
        EMAIL,
        'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_Q_ALL',
        default='w',
        choices=const.NOTIFICATION_DELIVERY_SCHEDULE_CHOICES,
        description=_('Default notification frequency all questions'),
        help_text=_(
                    'Option to define frequency of emailed updates for: '
                    'all questions.'
                    )
    )
)

settings.register(
    livesettings.StringValue(
        EMAIL,
        'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_Q_ASK',
        default='i',
        choices=const.NOTIFICATION_DELIVERY_SCHEDULE_CHOICES,
        description=_('Default notification frequency questions asked by the user'),
        help_text=_(
                    'Option to define frequency of emailed updates for: '
                    'Question asked by the user.'
                    )
    )
)

settings.register(
    livesettings.StringValue(
        EMAIL,
        'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_Q_ANS',
        default='d',
        choices=const.NOTIFICATION_DELIVERY_SCHEDULE_CHOICES,
        description=_('Default notification frequency questions answered by the user'),
        help_text=_(
                    'Option to define frequency of emailed updates for: '
                    'Question answered by the user.'
                    )
    )
)

settings.register(
    livesettings.StringValue(
        EMAIL,
        'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_Q_SEL',
        default='i',
        choices=const.NOTIFICATION_DELIVERY_SCHEDULE_CHOICES,
        description=_('Default notification frequency questions individually \
                       selected by the user'),
        help_text=_(
                    'Option to define frequency of emailed updates for: '
                    'Question individually selected by the user.'
                    )
    )
)

settings.register(
    livesettings.StringValue(
        EMAIL,
        'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_M_AND_C',
        default='i',
        choices=const.NOTIFICATION_DELIVERY_SCHEDULE_CHOICES,
        description=_('Default notification frequency for mentions \
                       and comments'),
        help_text=_(
                    'Option to define frequency of emailed updates for: '
                    'Mentions and comments.'
                    )
    )
)

settings.register(
    livesettings.BooleanValue(
        EMAIL,
        'ENABLE_UNANSWERED_REMINDERS',
        default = False,
        description = _('Send periodic reminders about unanswered questions'),
        help_text = _(
            'NOTE: in order to use this feature, it is necessary to '
            'run the management command "send_unanswered_question_reminders" '
            '(for example, via a cron job - with an appropriate frequency) '
        )
    )
)

settings.register(
    livesettings.IntegerValue(
        EMAIL,
        'DAYS_BEFORE_SENDING_UNANSWERED_REMINDER',
        default = 1,
        description = _(
            'Days before starting to send reminders about unanswered questions'
        ),
    )
)

settings.register(
    livesettings.IntegerValue(
        EMAIL,
        'UNANSWERED_REMINDER_FREQUENCY',
        default = 1,
        description = _(
            'How often to send unanswered question reminders '
            '(in days between the reminders sent).'
        )
    )
)

settings.register(
    livesettings.IntegerValue(
        EMAIL,
        'MAX_UNANSWERED_REMINDERS',
        default = 5,
        description = _(
            'Max. number of reminders to send '
            'about unanswered questions'
        )
    )
)

settings.register(
    livesettings.BooleanValue(
        EMAIL,
        'ENABLE_ACCEPT_ANSWER_REMINDERS',
        default = False,
        description = _('Send periodic reminders to accept the best answer'),
        help_text = _(
            'NOTE: in order to use this feature, it is necessary to '
            'run the management command "send_accept_answer_reminders" '
            '(for example, via a cron job - with an appropriate frequency) '
        )
    )
)

settings.register(
    livesettings.IntegerValue(
        EMAIL,
        'DAYS_BEFORE_SENDING_ACCEPT_ANSWER_REMINDER',
        default = 3,
        description = _(
            'Days before starting to send reminders to accept an answer'
        ),
    )
)

settings.register(
    livesettings.IntegerValue(
        EMAIL,
        'ACCEPT_ANSWER_REMINDER_FREQUENCY',
        default = 3,
        description = _(
            'How often to send accept answer reminders '
            '(in days between the reminders sent).'
        )
    )
)

settings.register(
    livesettings.IntegerValue(
        EMAIL,
        'MAX_ACCEPT_ANSWER_REMINDERS',
        default = 5,
        description = _(
            'Max. number of reminders to send '
            'to accept the best answer'
        )
    )
)

settings.register(
    livesettings.BooleanValue(
        EMAIL,
        'EMAIL_VALIDATION',
        default=False,
        hidden=True,
        description=_('Require email verification before allowing to post'),
        help_text=_('Active email verification is done by sending a verification key in email')
    )
)

settings.register(
    livesettings.StringValue(
        EMAIL,
        'ANONYMOUS_USER_EMAIL',
        default='anonymous@askbot.org',
        description=_('Fake email for anonymous user'),
        help_text=_('Use this setting to control gravatar for email-less user')
    )
)

settings.register(
    livesettings.BooleanValue(
        EMAIL,
        'ALLOW_ASKING_BY_EMAIL',
        default = False,
        description=_('Allow posting questions by email'),
        help_text=_(
            'Before enabling this setting - please fill out IMAP settings '
            'in the settings.py file'
        )
    )
)

settings.register(
    livesettings.BooleanValue(
        EMAIL,
        'REPLACE_SPACE_WITH_DASH_IN_EMAILED_TAGS',
        default = True,
        description = _('Replace space in emailed tags with dash'),
        help_text = _(
            'This setting applies to tags written in the subject line '
            'of questions asked by email'
        )
    )
)

settings.register(
     livesettings.BooleanValue(
         EMAIL,
        'REPLY_BY_EMAIL',
        default = False,
        description=_('Enable posting answers and comments by email'),
        #TODO give a better explanation depending on lamson startup procedure
        help_text=_(
            'To enable this feature make sure lamson is running'
            
        )
    )
)

settings.register(
    livesettings.StringValue(
        EMAIL,
        'SELF_NOTIFY_EMAILED_POST_AUTHOR_WHEN',
        description = _(
            'Emailed post: when to notify author about publishing'
        ),
        choices = const.SELF_NOTIFY_EMAILED_POST_AUTHOR_WHEN_CHOICES,
        default = const.NEVER
    )
)

#not implemented at this point
#settings.register(
#    livesettings.IntegerValue(
#        EMAIL,
#        'SELF_NOTIFY_WEB_POST_AUTHOR_WHEN',
#        description = _(
#            'Web post: when to notify author about publishing'
#        ),
#        choices = const.SELF_NOTIFY_WEB_POST_AUTHOR_WHEN_CHOICES,
#        default =  const.NEVER
#    )
#)

settings.register(
     livesettings.StringValue(
         EMAIL,
        'REPLY_BY_EMAIL_HOSTNAME',
        default = "",
        description=_('Reply by email hostname'),
        #TODO give a better explanation depending on lamson startup procedure
        
    )
)

settings.register(
    livesettings.IntegerValue(
        EMAIL,
        'MIN_WORDS_FOR_ANSWER_BY_EMAIL',
        default=14,
        description=_('Email replies having fewer words than this number will be posted as comments instead of answers')
    )
)