Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php
12256 views
1
<?php
2
3
final class PhabricatorMetaMTAConfigOptions
4
extends PhabricatorApplicationConfigOptions {
5
6
public function getName() {
7
return pht('Mail');
8
}
9
10
public function getDescription() {
11
return pht('Configure Mail.');
12
}
13
14
public function getIcon() {
15
return 'fa-send';
16
}
17
18
public function getGroup() {
19
return 'core';
20
}
21
22
public function getOptions() {
23
$send_as_user_desc = $this->deformat(pht(<<<EODOC
24
When a user takes an action which generates an email notification (like
25
commenting on a Differential revision), the "From" address can either be set
26
to the user's email address (like "[email protected]") or the
27
"metamta.defualt-address" address.
28
29
The user experience is generally better if the user's real address is used as
30
the "From" header value, since the messages are easier to organize when they
31
appear in mail clients, but this will only work if the server is authorized to
32
send email on behalf of the "From" domain. Practically, this means:
33
34
- If you are doing an install for Example Corp and all the users will have
35
corporate @corp.example.com addresses and any hosts this software is running
36
on are authorized to send email from corp.example.com, you can enable this
37
to make the user experience a little better.
38
- If you are doing an install for an open source project and your users will
39
be registering via third-party services and/or using personal email
40
addresses, you probably should not enable this or all of your outgoing
41
email might vanish into SFP blackholes.
42
- If your install is anything else, you're safer leaving this off, at least
43
initially, since the risk in turning it on is that your outgoing mail will
44
never arrive.
45
EODOC
46
));
47
48
$one_mail_per_recipient_desc = $this->deformat(pht(<<<EODOC
49
When a message is sent to multiple recipients (for example, several reviewers on
50
a code review), it can either be delieverd as one email to everyone (e.g., "To:
51
alincoln, usgrant, htaft") or separate emails to each user (e.g., "To:
52
alincoln", "To: usgrant", "To: htaft"). The major advantages and disadvantages
53
of each approach are:
54
55
- One mail to everyone:
56
- This violates policy controls. The body of the mail is generated without
57
respect for object policies.
58
- Recipients can see To/Cc at a glance.
59
- If you use mailing lists, you won't get duplicate mail if you're
60
a normal recipient and also Cc'd on a mailing list.
61
- Getting threading to work properly is harder, and probably requires
62
making mail less useful by turning off options.
63
- Sometimes people will "Reply All", which can send mail to too many
64
recipients. This software will try not to send mail to users who already
65
received a similar message, but can not prevent all stray email arising
66
from "Reply All".
67
- Not supported with a private reply-to address.
68
- Mail messages are sent in the server default translation.
69
- Mail that must be delivered over secure channels will leak the recipient
70
list in the "To" and "Cc" headers.
71
- One mail to each user:
72
- Policy controls work correctly and are enforced per-user.
73
- Recipients need to look in the mail body to see To/Cc.
74
- If you use mailing lists, recipients may sometimes get duplicate
75
mail.
76
- Getting threading to work properly is easier, and threading settings
77
can be customzied by each user.
78
- "Reply All" will never send extra mail to other users involved in the
79
thread.
80
- Required if private reply-to addresses are configured.
81
- Mail messages are sent in the language of user preference.
82
83
EODOC
84
));
85
86
$reply_hints_description = $this->deformat(pht(<<<EODOC
87
You can disable the hints under "REPLY HANDLER ACTIONS" if users prefer
88
smaller messages. The actions themselves will still work properly.
89
EODOC
90
));
91
92
$recipient_hints_description = $this->deformat(pht(<<<EODOC
93
You can disable the "To:" and "Cc:" footers in mail if users prefer smaller
94
messages.
95
EODOC
96
));
97
98
$email_preferences_description = $this->deformat(pht(<<<EODOC
99
You can disable the email preference link in emails if users prefer smaller
100
emails.
101
EODOC
102
));
103
104
$re_prefix_description = $this->deformat(pht(<<<EODOC
105
Mail.app on OS X Lion won't respect threading headers unless the subject is
106
prefixed with "Re:". If you enable this option, this software will add "Re:" to
107
the subject line of all mail which is expected to thread. If you've set
108
'metamta.one-mail-per-recipient', users can override this setting in their
109
preferences.
110
EODOC
111
));
112
113
$vary_subjects_description = $this->deformat(pht(<<<EODOC
114
If true, allow MetaMTA to change mail subjects to put text like '[Accepted]' and
115
'[Commented]' in them. This makes subjects more useful, but might break
116
threading on some clients. If you've set '%s', users can override this setting
117
in their preferences.
118
EODOC
119
,
120
'metamta.one-mail-per-recipient'));
121
122
$reply_to_description = $this->deformat(pht(<<<EODOC
123
If you enable `%s`, this software uses "From" to authenticate users. You can
124
additionally enable this setting to try to authenticate with 'Reply-To'. Note
125
that this is completely spoofable and insecure (any user can set any 'Reply-To'
126
address) but depending on the nature of your install or other deliverability
127
conditions this might be okay. Generally, you can't do much more by spoofing
128
Reply-To than be annoying (you can write but not read content). But this is
129
still **COMPLETELY INSECURE**.
130
EODOC
131
,
132
'metamta.public-replies'));
133
134
$adapter_description = $this->deformat(pht(<<<EODOC
135
Adapter class to use to transmit mail to the MTA. The default uses
136
PHPMailerLite, which will invoke "sendmail". This is appropriate if sendmail
137
actually works on your host, but if you haven't configured mail it may not be so
138
great. A number of other mailers are available (e.g., SES, SendGrid, SMTP,
139
custom mailers). This option is deprecated in favor of 'cluster.mailers'.
140
EODOC
141
));
142
143
$public_replies_description = $this->deformat(pht(<<<EODOC
144
By default, this software generates unique reply-to addresses and sends a
145
separate email to each recipient when you enable reply handling. This is more
146
secure than using "From" to establish user identity, but can mean users may
147
receive multiple emails when they are on mailing lists. Instead, you can use a
148
single, non-unique reply to address and authenticate users based on the "From"
149
address by setting this to 'true'. This trades away a little bit of security
150
for convenience, but it's reasonable in many installs. Object interactions are
151
still protected using hashes in the single public email address, so objects
152
can not be replied to blindly.
153
EODOC
154
));
155
156
$single_description = $this->deformat(pht(<<<EODOC
157
If you want to use a single mailbox for reply mail, you can use this
158
and set a common prefix for generated reply addresses. It will
159
make use of the fact that a mail-address such as
160
`[email protected]` will be delivered to the `devtools`
161
user's mailbox. Set this to the left part of the email address and it will be
162
prepended to all generated reply addresses.
163
164
For example, if you want to use `[email protected]`, this should be set
165
to `devtools`.
166
EODOC
167
));
168
169
$address_description = $this->deformat(pht(<<<EODOC
170
When email is sent, what format should the software use for users' email
171
addresses? Valid values are:
172
173
- `short`: 'gwashington <[email protected]>'
174
- `real`: 'George Washington <[email protected]>'
175
- `full`: 'gwashington (George Washington) <[email protected]>'
176
177
The default is `full`.
178
EODOC
179
));
180
181
$mailers_description = $this->deformat(pht(<<<EODOC
182
Define one or more mail transmission services. For help with configuring
183
mailers, see **[[ %s | %s ]]** in the documentation.
184
EODOC
185
,
186
PhabricatorEnv::getDoclink('Configuring Outbound Email'),
187
pht('Configuring Outbound Email')));
188
189
$default_description = $this->deformat(pht(<<<EODOC
190
Default address used as a "From" or "To" email address when an address is
191
required but no meaningful address is available.
192
193
If you configure inbound mail, you generally do not need to set this:
194
the software will automatically generate and use a suitable mailbox on the
195
inbound mail domain.
196
197
Otherwise, this option should be configured to point at a valid mailbox which
198
discards all mail sent to it. If you point it at an invalid mailbox, mail sent
199
by the software and some mail sent by users will bounce. If you point it at a
200
real user mailbox, that user will get a lot of mail they don't want.
201
202
For further guidance, see **[[ %s | %s ]]** in the documentation.
203
EODOC
204
,
205
PhabricatorEnv::getDoclink('Configuring Outbound Email'),
206
pht('Configuring Outbound Email')));
207
208
return array(
209
$this->newOption('cluster.mailers', 'cluster.mailers', array())
210
->setHidden(true)
211
->setDescription($mailers_description),
212
$this->newOption('metamta.default-address', 'string', null)
213
->setLocked(true)
214
->setSummary(pht('Default address used when generating mail.'))
215
->setDescription($default_description),
216
$this->newOption(
217
'metamta.one-mail-per-recipient',
218
'bool',
219
true)
220
->setLocked(true)
221
->setBoolOptions(
222
array(
223
pht('Send Mail To Each Recipient'),
224
pht('Send Mail To All Recipients'),
225
))
226
->setSummary(
227
pht(
228
'Controls whether email for multiple recipients is sent by '.
229
'creating one message with everyone in the "To:" line, or '.
230
'multiple messages that each have a single recipeint in the '.
231
'"To:" line.'))
232
->setDescription($one_mail_per_recipient_desc),
233
$this->newOption('metamta.can-send-as-user', 'bool', false)
234
->setBoolOptions(
235
array(
236
pht('Send as User Taking Action'),
237
pht(
238
'Send as %s',
239
PlatformSymbols::getPlatformServerName()),
240
))
241
->setSummary(
242
pht(
243
'Controls whether email is sent "From" users.'))
244
->setDescription($send_as_user_desc),
245
$this->newOption(
246
'metamta.reply-handler-domain',
247
'string',
248
null)
249
->setLocked(true)
250
->setDescription(pht('Domain used for reply email addresses.'))
251
->addExample('devtools.example.com', ''),
252
$this->newOption('metamta.recipients.show-hints', 'bool', true)
253
->setBoolOptions(
254
array(
255
pht('Show Recipient Hints'),
256
pht('No Recipient Hints'),
257
))
258
->setSummary(pht('Show "To:" and "Cc:" footer hints in email.'))
259
->setDescription($recipient_hints_description),
260
$this->newOption('metamta.email-preferences', 'bool', true)
261
->setBoolOptions(
262
array(
263
pht('Show Email Preferences Link'),
264
pht('No Email Preferences Link'),
265
))
266
->setSummary(pht('Show email preferences link in email.'))
267
->setDescription($email_preferences_description),
268
$this->newOption('metamta.public-replies', 'bool', false)
269
->setBoolOptions(
270
array(
271
pht('Use Public Replies (Less Secure)'),
272
pht('Use Private Replies (More Secure)'),
273
))
274
->setSummary(
275
pht(
276
'Reply addresses can either be private (more secure) or '.
277
'public (which works better with mailing lists).'))
278
->setDescription($public_replies_description),
279
$this->newOption('metamta.single-reply-handler-prefix', 'string', null)
280
->setSummary(
281
pht('Allow a single mailbox to be used for all replies.'))
282
->setDescription($single_description),
283
$this->newOption('metamta.user-address-format', 'enum', 'full')
284
->setEnumOptions(
285
array(
286
'short' => pht('Short'),
287
'real' => pht('Real'),
288
'full' => pht('Full'),
289
))
290
->setSummary(pht('Control how user names are rendered in mail.'))
291
->setDescription($address_description)
292
->addExample('gwashington <[email protected]>', 'short')
293
->addExample('George Washington <[email protected]>', 'real')
294
->addExample(
295
'gwashington (George Washington) <[email protected]>',
296
'full'),
297
$this->newOption('metamta.email-body-limit', 'int', 524288)
298
->setDescription(
299
pht(
300
'You can set a limit for the maximum byte size of outbound mail. '.
301
'Mail which is larger than this limit will be truncated before '.
302
'being sent. This can be useful if your MTA rejects mail which '.
303
'exceeds some limit (this is reasonably common). Specify a value '.
304
'in bytes.'))
305
->setSummary(pht('Global cap for size of generated emails (bytes).'))
306
->addExample(524288, pht('Truncate at 512KB'))
307
->addExample(1048576, pht('Truncate at 1MB')),
308
);
309
}
310
311
}
312
313