Path: blob/master/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php
12256 views
<?php12final class PhabricatorMetaMTAConfigOptions3extends PhabricatorApplicationConfigOptions {45public function getName() {6return pht('Mail');7}89public function getDescription() {10return pht('Configure Mail.');11}1213public function getIcon() {14return 'fa-send';15}1617public function getGroup() {18return 'core';19}2021public function getOptions() {22$send_as_user_desc = $this->deformat(pht(<<<EODOC23When a user takes an action which generates an email notification (like24commenting on a Differential revision), the "From" address can either be set25to the user's email address (like "[email protected]") or the26"metamta.defualt-address" address.2728The user experience is generally better if the user's real address is used as29the "From" header value, since the messages are easier to organize when they30appear in mail clients, but this will only work if the server is authorized to31send email on behalf of the "From" domain. Practically, this means:3233- If you are doing an install for Example Corp and all the users will have34corporate @corp.example.com addresses and any hosts this software is running35on are authorized to send email from corp.example.com, you can enable this36to make the user experience a little better.37- If you are doing an install for an open source project and your users will38be registering via third-party services and/or using personal email39addresses, you probably should not enable this or all of your outgoing40email might vanish into SFP blackholes.41- If your install is anything else, you're safer leaving this off, at least42initially, since the risk in turning it on is that your outgoing mail will43never arrive.44EODOC45));4647$one_mail_per_recipient_desc = $this->deformat(pht(<<<EODOC48When a message is sent to multiple recipients (for example, several reviewers on49a code review), it can either be delieverd as one email to everyone (e.g., "To:50alincoln, usgrant, htaft") or separate emails to each user (e.g., "To:51alincoln", "To: usgrant", "To: htaft"). The major advantages and disadvantages52of each approach are:5354- One mail to everyone:55- This violates policy controls. The body of the mail is generated without56respect for object policies.57- Recipients can see To/Cc at a glance.58- If you use mailing lists, you won't get duplicate mail if you're59a normal recipient and also Cc'd on a mailing list.60- Getting threading to work properly is harder, and probably requires61making mail less useful by turning off options.62- Sometimes people will "Reply All", which can send mail to too many63recipients. This software will try not to send mail to users who already64received a similar message, but can not prevent all stray email arising65from "Reply All".66- Not supported with a private reply-to address.67- Mail messages are sent in the server default translation.68- Mail that must be delivered over secure channels will leak the recipient69list in the "To" and "Cc" headers.70- One mail to each user:71- Policy controls work correctly and are enforced per-user.72- Recipients need to look in the mail body to see To/Cc.73- If you use mailing lists, recipients may sometimes get duplicate74mail.75- Getting threading to work properly is easier, and threading settings76can be customzied by each user.77- "Reply All" will never send extra mail to other users involved in the78thread.79- Required if private reply-to addresses are configured.80- Mail messages are sent in the language of user preference.8182EODOC83));8485$reply_hints_description = $this->deformat(pht(<<<EODOC86You can disable the hints under "REPLY HANDLER ACTIONS" if users prefer87smaller messages. The actions themselves will still work properly.88EODOC89));9091$recipient_hints_description = $this->deformat(pht(<<<EODOC92You can disable the "To:" and "Cc:" footers in mail if users prefer smaller93messages.94EODOC95));9697$email_preferences_description = $this->deformat(pht(<<<EODOC98You can disable the email preference link in emails if users prefer smaller99emails.100EODOC101));102103$re_prefix_description = $this->deformat(pht(<<<EODOC104Mail.app on OS X Lion won't respect threading headers unless the subject is105prefixed with "Re:". If you enable this option, this software will add "Re:" to106the subject line of all mail which is expected to thread. If you've set107'metamta.one-mail-per-recipient', users can override this setting in their108preferences.109EODOC110));111112$vary_subjects_description = $this->deformat(pht(<<<EODOC113If true, allow MetaMTA to change mail subjects to put text like '[Accepted]' and114'[Commented]' in them. This makes subjects more useful, but might break115threading on some clients. If you've set '%s', users can override this setting116in their preferences.117EODOC118,119'metamta.one-mail-per-recipient'));120121$reply_to_description = $this->deformat(pht(<<<EODOC122If you enable `%s`, this software uses "From" to authenticate users. You can123additionally enable this setting to try to authenticate with 'Reply-To'. Note124that this is completely spoofable and insecure (any user can set any 'Reply-To'125address) but depending on the nature of your install or other deliverability126conditions this might be okay. Generally, you can't do much more by spoofing127Reply-To than be annoying (you can write but not read content). But this is128still **COMPLETELY INSECURE**.129EODOC130,131'metamta.public-replies'));132133$adapter_description = $this->deformat(pht(<<<EODOC134Adapter class to use to transmit mail to the MTA. The default uses135PHPMailerLite, which will invoke "sendmail". This is appropriate if sendmail136actually works on your host, but if you haven't configured mail it may not be so137great. A number of other mailers are available (e.g., SES, SendGrid, SMTP,138custom mailers). This option is deprecated in favor of 'cluster.mailers'.139EODOC140));141142$public_replies_description = $this->deformat(pht(<<<EODOC143By default, this software generates unique reply-to addresses and sends a144separate email to each recipient when you enable reply handling. This is more145secure than using "From" to establish user identity, but can mean users may146receive multiple emails when they are on mailing lists. Instead, you can use a147single, non-unique reply to address and authenticate users based on the "From"148address by setting this to 'true'. This trades away a little bit of security149for convenience, but it's reasonable in many installs. Object interactions are150still protected using hashes in the single public email address, so objects151can not be replied to blindly.152EODOC153));154155$single_description = $this->deformat(pht(<<<EODOC156If you want to use a single mailbox for reply mail, you can use this157and set a common prefix for generated reply addresses. It will158make use of the fact that a mail-address such as159`[email protected]` will be delivered to the `devtools`160user's mailbox. Set this to the left part of the email address and it will be161prepended to all generated reply addresses.162163For example, if you want to use `[email protected]`, this should be set164to `devtools`.165EODOC166));167168$address_description = $this->deformat(pht(<<<EODOC169When email is sent, what format should the software use for users' email170addresses? Valid values are:171172- `short`: 'gwashington <[email protected]>'173- `real`: 'George Washington <[email protected]>'174- `full`: 'gwashington (George Washington) <[email protected]>'175176The default is `full`.177EODOC178));179180$mailers_description = $this->deformat(pht(<<<EODOC181Define one or more mail transmission services. For help with configuring182mailers, see **[[ %s | %s ]]** in the documentation.183EODOC184,185PhabricatorEnv::getDoclink('Configuring Outbound Email'),186pht('Configuring Outbound Email')));187188$default_description = $this->deformat(pht(<<<EODOC189Default address used as a "From" or "To" email address when an address is190required but no meaningful address is available.191192If you configure inbound mail, you generally do not need to set this:193the software will automatically generate and use a suitable mailbox on the194inbound mail domain.195196Otherwise, this option should be configured to point at a valid mailbox which197discards all mail sent to it. If you point it at an invalid mailbox, mail sent198by the software and some mail sent by users will bounce. If you point it at a199real user mailbox, that user will get a lot of mail they don't want.200201For further guidance, see **[[ %s | %s ]]** in the documentation.202EODOC203,204PhabricatorEnv::getDoclink('Configuring Outbound Email'),205pht('Configuring Outbound Email')));206207return array(208$this->newOption('cluster.mailers', 'cluster.mailers', array())209->setHidden(true)210->setDescription($mailers_description),211$this->newOption('metamta.default-address', 'string', null)212->setLocked(true)213->setSummary(pht('Default address used when generating mail.'))214->setDescription($default_description),215$this->newOption(216'metamta.one-mail-per-recipient',217'bool',218true)219->setLocked(true)220->setBoolOptions(221array(222pht('Send Mail To Each Recipient'),223pht('Send Mail To All Recipients'),224))225->setSummary(226pht(227'Controls whether email for multiple recipients is sent by '.228'creating one message with everyone in the "To:" line, or '.229'multiple messages that each have a single recipeint in the '.230'"To:" line.'))231->setDescription($one_mail_per_recipient_desc),232$this->newOption('metamta.can-send-as-user', 'bool', false)233->setBoolOptions(234array(235pht('Send as User Taking Action'),236pht(237'Send as %s',238PlatformSymbols::getPlatformServerName()),239))240->setSummary(241pht(242'Controls whether email is sent "From" users.'))243->setDescription($send_as_user_desc),244$this->newOption(245'metamta.reply-handler-domain',246'string',247null)248->setLocked(true)249->setDescription(pht('Domain used for reply email addresses.'))250->addExample('devtools.example.com', ''),251$this->newOption('metamta.recipients.show-hints', 'bool', true)252->setBoolOptions(253array(254pht('Show Recipient Hints'),255pht('No Recipient Hints'),256))257->setSummary(pht('Show "To:" and "Cc:" footer hints in email.'))258->setDescription($recipient_hints_description),259$this->newOption('metamta.email-preferences', 'bool', true)260->setBoolOptions(261array(262pht('Show Email Preferences Link'),263pht('No Email Preferences Link'),264))265->setSummary(pht('Show email preferences link in email.'))266->setDescription($email_preferences_description),267$this->newOption('metamta.public-replies', 'bool', false)268->setBoolOptions(269array(270pht('Use Public Replies (Less Secure)'),271pht('Use Private Replies (More Secure)'),272))273->setSummary(274pht(275'Reply addresses can either be private (more secure) or '.276'public (which works better with mailing lists).'))277->setDescription($public_replies_description),278$this->newOption('metamta.single-reply-handler-prefix', 'string', null)279->setSummary(280pht('Allow a single mailbox to be used for all replies.'))281->setDescription($single_description),282$this->newOption('metamta.user-address-format', 'enum', 'full')283->setEnumOptions(284array(285'short' => pht('Short'),286'real' => pht('Real'),287'full' => pht('Full'),288))289->setSummary(pht('Control how user names are rendered in mail.'))290->setDescription($address_description)291->addExample('gwashington <[email protected]>', 'short')292->addExample('George Washington <[email protected]>', 'real')293->addExample(294'gwashington (George Washington) <[email protected]>',295'full'),296$this->newOption('metamta.email-body-limit', 'int', 524288)297->setDescription(298pht(299'You can set a limit for the maximum byte size of outbound mail. '.300'Mail which is larger than this limit will be truncated before '.301'being sent. This can be useful if your MTA rejects mail which '.302'exceeds some limit (this is reasonably common). Specify a value '.303'in bytes.'))304->setSummary(pht('Global cap for size of generated emails (bytes).'))305->addExample(524288, pht('Truncate at 512KB'))306->addExample(1048576, pht('Truncate at 1MB')),307);308}309310}311312313