Skip to content

Commit d710fc0

Browse files
author
epriestley
committed
Improve messaging and setup process for configuring outbound email.
Summary: - Make the instructional text generally more useful. - Show the current configured adapter. - When the configuration prevents outbound email from being delivered, show a warning. - Detect 'curl' extension during setup since it's more-or-less required - Add curl extension to the install scripts codeblock: can you verify the rhel-derivs changes are correct? Test Plan: Set adapter to test, verified warning; entered setup mode and verified curl. Ran apt-get on an ubuntu box. Ran yum on an amazon linux box. Reviewed By: toulouse Reviewers: toulouse, codeblock Commenters: codeblock CC: aran, jungejason, tuomaspelkonen, codeblock, epriestley, toulouse Differential Revision: 438
1 parent fedbd47 commit d710fc0

File tree

4 files changed

+46
-4
lines changed

4 files changed

+46
-4
lines changed

scripts/install/install_ubuntu.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ echo
3737
set +x
3838

3939
sudo apt-get -qq update
40-
sudo apt-get install git mysql-server apache2 php5 php5-mysql php5-gd php5-dev php-apc dpkg-dev
40+
sudo apt-get install git mysql-server apache2 php5 php5-mysql php5-gd php5-dev php5-curl php-apc dpkg-dev
4141

4242
HAVEPCNTL=`php -r "echo extension_loaded('pcntl');"`
4343
if [ $HAVEPCNTL != "1" ]

src/applications/metamta/controller/send/PhabricatorMetaMTASendController.php

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,44 @@ public function processRequest() {
4545
"Enter a number to simulate that many consecutive send failures before ".
4646
"really attempting to deliver via the underlying MTA.";
4747

48+
$doclink_href = PhabricatorEnv::getDoclink(
49+
'article/Configuring_Outbound_Email.html');
50+
51+
$doclink = phutil_render_tag(
52+
'a',
53+
array(
54+
'href' => $doclink_href,
55+
'target' => '_blank',
56+
),
57+
'Configuring Outbound Email');
58+
$instructions =
59+
'<p class="aphront-form-instructions">This form will send a normal '.
60+
'email using the settings you have configured for Phabricator. For more '.
61+
'information, see '.$doclink.'.</p>';
62+
63+
$adapter = PhabricatorEnv::getEnvConfig('metamta.mail-adapter');
64+
$warning = null;
65+
if ($adapter == 'PhabricatorMailImplementationTestAdapter') {
66+
$warning = new AphrontErrorView();
67+
$warning->setTitle('Email is Disabled');
68+
$warning->setSeverity(AphrontErrorView::SEVERITY_WARNING);
69+
$warning->appendChild(
70+
'<p>This installation of Phabricator is currently set to use '.
71+
'<tt>PhabricatorMailImplementationTestAdapter</tt> to deliver '.
72+
'outbound email. This completely disables outbound email! All '.
73+
'outbound email will be thrown in a deep, dark hole until you '.
74+
'configure a real adapter.</p>');
75+
}
4876

4977
$form = new AphrontFormView();
5078
$form->setUser($request->getUser());
5179
$form->setAction('/mail/send/');
5280
$form
81+
->appendChild($instructions)
5382
->appendChild(
54-
'<p class="aphront-form-instructions">This form will send a normal '.
55-
'email using MetaMTA as a transport mechanism.</p>')
83+
id(new AphrontFormStaticControl())
84+
->setLabel('Configured Adapter')
85+
->setValue($adapter))
5686
->appendChild(
5787
id(new AphrontFormTokenizerControl())
5888
->setLabel('To')
@@ -97,7 +127,10 @@ public function processRequest() {
97127
$panel->setWidth(AphrontPanelView::WIDTH_WIDE);
98128

99129
return $this->buildStandardPageResponse(
100-
$panel,
130+
array(
131+
$warning,
132+
$panel,
133+
),
101134
array(
102135
'title' => 'Send Mail',
103136
));

src/applications/metamta/controller/send/__init__.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@
99
phutil_require_module('phabricator', 'aphront/response/redirect');
1010
phutil_require_module('phabricator', 'applications/metamta/controller/base');
1111
phutil_require_module('phabricator', 'applications/metamta/storage/mail');
12+
phutil_require_module('phabricator', 'infrastructure/env');
1213
phutil_require_module('phabricator', 'view/form/base');
1314
phutil_require_module('phabricator', 'view/form/control/checkbox');
15+
phutil_require_module('phabricator', 'view/form/control/static');
1416
phutil_require_module('phabricator', 'view/form/control/submit');
1517
phutil_require_module('phabricator', 'view/form/control/text');
1618
phutil_require_module('phabricator', 'view/form/control/textarea');
1719
phutil_require_module('phabricator', 'view/form/control/tokenizer');
20+
phutil_require_module('phabricator', 'view/form/error');
1821
phutil_require_module('phabricator', 'view/layout/panel');
1922

23+
phutil_require_module('phutil', 'markup');
2024
phutil_require_module('phutil', 'utils');
2125

2226

src/infrastructure/setup/PhabricatorSetup.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ public static function runSetup() {
3737
'hash',
3838
'json',
3939
'openssl',
40+
41+
// There is a chance we might not need this, but some configurations (like
42+
// Amazon SES) will require it. Just mark it 'required' since it's widely
43+
// available and relatively core.
44+
'curl',
4045
);
4146
foreach ($extensions as $extension) {
4247
$ok = self::requireExtension($extension);

0 commit comments

Comments
 (0)