2011-05-12 08:15:02 -07:00
|
|
|
@title Configuring Outbound Email
|
|
|
|
@group config
|
|
|
|
|
|
|
|
Instructions for configuring Phabricator to send mail.
|
|
|
|
|
|
|
|
= Overview =
|
|
|
|
|
2014-04-21 15:45:29 -07:00
|
|
|
Phabricator can send outbound email via several different providers, called
|
|
|
|
"Adapters".
|
|
|
|
|
|
|
|
| Send Mail With | Setup | Cost | Inbound | Notes |
|
|
|
|
|---------|-------|------|---------|-------|
|
|
|
|
| Mailgun | Easy | Cheap | Yes | Recommended |
|
|
|
|
| Amazon SES | Easy | Cheap | No | Recommended |
|
|
|
|
| SendGrid | Easy | Cheap | Yes | |
|
|
|
|
| External SMTP | Medium | Varies | No | Gmail, etc. |
|
|
|
|
| Local SMTP | Hard | Free | No | (Default) sendmail, postfix, etc |
|
|
|
|
| Custom | Hard | Free | No | Write an adapter for some other service. |
|
|
|
|
| Drop in a Hole | Easy | Free | No | Drops mail in a deep, dark hole. |
|
|
|
|
|
|
|
|
Of these options, sending mail via local SMTP is the default, but usually
|
|
|
|
requires some configuration to get working. See below for details on how to
|
|
|
|
select and configure a delivery method.
|
|
|
|
|
|
|
|
Overall, Mailgun and SES are much easier to set up, and using one of them is
|
|
|
|
recommended. In particular, Mailgun will also let you set up inbound email
|
|
|
|
easily.
|
|
|
|
|
|
|
|
If you have some internal mail service you'd like to use you can also
|
|
|
|
write a custom adapter, but this requires digging into the code.
|
|
|
|
|
|
|
|
Phabricator sends mail in the background, so the daemons need to be running for
|
|
|
|
it to be able to deliver mail. You should receive setup warnings if they are
|
|
|
|
not. For more information on using daemons, see
|
2012-07-23 12:04:53 -07:00
|
|
|
@{article:Managing Daemons with phd}.
|
2011-05-12 08:15:02 -07:00
|
|
|
|
|
|
|
= Basics =
|
|
|
|
|
|
|
|
Regardless of how outbound email is delivered, you should configure these keys
|
2014-04-21 15:45:29 -07:00
|
|
|
in your configuration:
|
2011-05-12 08:15:02 -07:00
|
|
|
|
|
|
|
- **metamta.default-address** determines where mail is sent "From" by
|
2014-04-21 15:45:29 -07:00
|
|
|
default. If your domain is `example.org`, set this to something like
|
|
|
|
`noreply@example.org`.
|
|
|
|
- **metamta.domain** should be set to your domain, e.g. `example.org`.
|
2011-05-12 08:15:02 -07:00
|
|
|
- **metamta.can-send-as-user** should be left as ##false## in most cases,
|
2014-04-21 15:45:29 -07:00
|
|
|
but see the documentation for details.
|
2011-05-12 08:15:02 -07:00
|
|
|
|
|
|
|
= Configuring Mail Adapters =
|
|
|
|
|
2014-04-21 15:45:29 -07:00
|
|
|
To choose how mail will be sent, change the `metamta.mail-adapter` key in
|
|
|
|
your configuration. Possible values are listed in the UI:
|
2011-05-12 08:15:02 -07:00
|
|
|
|
2014-04-21 15:45:29 -07:00
|
|
|
- ##PhabricatorMailImplementationAmazonMailgunAdapter##: use Mailgun, see
|
|
|
|
"Adapter: Mailgun".
|
|
|
|
- ##PhabricatorMailImplementationAmazonSESAdapter##: use Amazon SES, see
|
|
|
|
"Adapter: Amazon SES".
|
2011-05-12 08:15:02 -07:00
|
|
|
- ##PhabricatorMailImplementationPHPMailerLiteAdapter##: default, uses
|
|
|
|
"sendmail", see "Adapter: Sendmail".
|
2012-12-09 02:36:40 -08:00
|
|
|
- ##PhabricatorMailImplementationPHPMailerAdapter##: uses SMTP, see
|
|
|
|
"Adapter: SMTP".
|
2011-05-26 10:00:26 -07:00
|
|
|
- ##PhabricatorMailImplementationSendGridAdapter##: use SendGrid, see
|
|
|
|
"Adapter: SendGrid".
|
2011-05-12 08:15:02 -07:00
|
|
|
- ##Some Custom Class You Write##: use a custom adapter you write, see
|
|
|
|
"Adapter: Custom".
|
|
|
|
- ##PhabricatorMailImplementationTestAdapter##: this will
|
|
|
|
**completely disable** outbound mail. You can use this if you don't want to
|
|
|
|
send outbound mail, or want to skip this step for now and configure it
|
|
|
|
later.
|
|
|
|
|
|
|
|
= Adapter: Sendmail =
|
|
|
|
|
|
|
|
This is the default, and selected by choosing
|
2014-04-21 15:45:29 -07:00
|
|
|
`PhabricatorMailImplementationPHPMailerLiteAdapter` as the value for
|
|
|
|
**metamta.mail-adapter**. This requires a `sendmail` binary to be installed on
|
2011-05-12 08:15:02 -07:00
|
|
|
the system. Most MTAs (e.g., sendmail, qmail, postfix) should do this, but your
|
|
|
|
machine may not have one installed by default. For install instructions, consult
|
|
|
|
the documentation for your favorite MTA.
|
|
|
|
|
|
|
|
Since you'll be sending the mail yourself, you are subject to things like SPF
|
|
|
|
rules, blackholes, and MTA configuration which are beyond the scope of this
|
|
|
|
document. If you can already send outbound email from the command line or know
|
|
|
|
how to configure it, this option is straightforward. If you have no idea how to
|
2014-04-21 15:45:29 -07:00
|
|
|
do any of this, strongly consider using Mailgun or Amazon SES instead.
|
2011-05-12 08:15:02 -07:00
|
|
|
|
2012-12-09 02:36:40 -08:00
|
|
|
= Adapter: SMTP =
|
|
|
|
|
2014-04-21 15:45:29 -07:00
|
|
|
You can use this adapter to send mail via an external SMTP server, like Gmail.
|
|
|
|
To do this, set these configuration keys:
|
2012-12-09 02:36:40 -08:00
|
|
|
|
|
|
|
- **metamta.mail-adapter**: set to
|
2014-04-21 15:45:29 -07:00
|
|
|
`PhabricatorMailImplementationPHPMailerAdapter`.
|
|
|
|
- **phpmailer.mailer**: set to `smtp`.
|
|
|
|
- **phpmailer.smtp-host**: set to hostname of your SMTP server.
|
|
|
|
- **phpmailer.smtp-port**: set to port of your SMTP server.
|
2012-12-09 02:36:40 -08:00
|
|
|
- **phpmailer.smtp-user**: set to your username used for authentication.
|
|
|
|
- **phpmailer.smtp-password**: set to your password used for authentication.
|
2014-04-21 15:45:29 -07:00
|
|
|
- **phpmailer.smtp-protocol**: set to `tls` or `ssl` if necessary. Use
|
|
|
|
`ssl` for Gmail.
|
|
|
|
|
|
|
|
= Adapter: Mailgun =
|
|
|
|
|
|
|
|
Mailgun is an email delivery service. You can learn more at
|
|
|
|
<http://www.mailgun.com>. Mailgun isn't free, but is very easy to configure
|
|
|
|
and works well.
|
|
|
|
|
|
|
|
To use Mailgun, sign up for an account, then set these configuration keys:
|
|
|
|
|
|
|
|
- **metamta.mail-adapter**: set to
|
|
|
|
`PhabricatorMailImplementationMailgunAdapter`.
|
|
|
|
- **mailgun.api-key**: set to your Mailgun API key.
|
|
|
|
- **mailgun.domain**: set to your Mailgun domain.
|
2012-12-09 02:36:40 -08:00
|
|
|
|
2011-05-12 08:15:02 -07:00
|
|
|
= Adapter: Amazon SES =
|
|
|
|
|
|
|
|
Amazon SES is Amazon's cloud email service. It is not free, but is easier to
|
|
|
|
configure than sendmail and can simplify outbound email configuration. To use
|
|
|
|
Amazon SES, you need to sign up for an account with Amazon at
|
|
|
|
<http://aws.amazon.com/ses/>.
|
|
|
|
|
|
|
|
To configure Phabricator to use Amazon SES, set these configuration keys:
|
|
|
|
|
|
|
|
- **metamta.mail-adapter**: set to
|
|
|
|
"PhabricatorMailImplementationAmazonSESAdapter".
|
|
|
|
- **amazon-ses.access-key**: set to your Amazon SES access key.
|
|
|
|
- **amazon-ses.secret-key**: set to your Amazon SES secret key.
|
|
|
|
|
2011-06-12 19:04:34 -07:00
|
|
|
NOTE: Amazon SES **requires you to verify your "From" address**. Configure which
|
|
|
|
"From" address to use by setting "##metamta.default-address##" in your config,
|
|
|
|
then follow the Amazon SES verification process to verify it. You won't be able
|
|
|
|
to send email until you do this!
|
|
|
|
|
2011-05-26 10:00:26 -07:00
|
|
|
= Adapter: SendGrid =
|
|
|
|
|
|
|
|
SendGrid is an email delivery service like Amazon SES. You can learn more at
|
|
|
|
<http://sendgrid.com/>. It is easy to configure, but not free.
|
|
|
|
|
|
|
|
You can configure SendGrid in two ways: you can send via SMTP or via the REST
|
|
|
|
API. To use SMTP, just configure ##sendmail## and leave Phabricator's setup
|
|
|
|
with defaults. To use the REST API, follow the instructions in this section.
|
|
|
|
|
|
|
|
To configure Phabricator to use SendGrid, set these configuration keys:
|
|
|
|
|
|
|
|
- **metamta.mail-adapter**: set to
|
|
|
|
"PhabricatorMailImplementationSendGridAdapter".
|
|
|
|
- **sendgrid.api-user**: set to your SendGrid login name.
|
|
|
|
- **sendgrid.api-key**: set to your SendGrid password.
|
|
|
|
|
|
|
|
If you're logged into your SendGrid account, you may be able to find this
|
|
|
|
information easily by visiting <http://sendgrid.com/developer>.
|
|
|
|
|
2011-05-12 08:15:02 -07:00
|
|
|
= Adapter: Custom =
|
|
|
|
|
|
|
|
You can provide a custom adapter by writing a concrete subclass of
|
|
|
|
@{class:PhabricatorMailImplementationAdapter} and setting it as the
|
2014-04-21 15:45:29 -07:00
|
|
|
`metamta.mail-adapter`.
|
2011-05-12 08:15:02 -07:00
|
|
|
|
2014-04-21 15:45:29 -07:00
|
|
|
TODO: This should be better documented once extending Phabricator is better
|
2011-05-12 08:15:02 -07:00
|
|
|
documented.
|
|
|
|
|
|
|
|
= Adapter: Disable Outbound Mail =
|
|
|
|
|
|
|
|
You can use the @{class:PhabricatorMailImplementationTestAdapter} to completely
|
|
|
|
disable outbound mail, if you don't want to send mail or don't want to configure
|
|
|
|
it yet. Just set **metamta.mail-adapter** to
|
2014-04-21 15:45:29 -07:00
|
|
|
`PhabricatorMailImplementationTestAdapter`.
|
2011-05-12 08:15:02 -07:00
|
|
|
|
|
|
|
= Testing and Debugging Outbound Email =
|
|
|
|
|
2013-07-10 18:52:42 -07:00
|
|
|
You can use the `bin/mail` utility to test, debug, and examine outbound mail. In
|
|
|
|
particular:
|
2011-05-12 08:15:02 -07:00
|
|
|
|
2013-07-10 18:52:42 -07:00
|
|
|
phabricator/ $ ./bin/mail list-outbound # List outbound mail.
|
|
|
|
phabricator/ $ ./bin/mail show-outbound # Show details about messages.
|
|
|
|
phabricator/ $ ./bin/mail send-test # Send test messages.
|
2011-05-12 08:15:02 -07:00
|
|
|
|
2013-07-10 18:52:42 -07:00
|
|
|
Run `bin/mail help <command>` for more help on using these commands.
|
2011-05-12 08:15:02 -07:00
|
|
|
|
|
|
|
You can monitor daemons using the Daemon Console (##/daemon/##, or click
|
|
|
|
**Daemon Console** from the homepage).
|
|
|
|
|
|
|
|
= Next Steps =
|
|
|
|
|
|
|
|
Continue by:
|
|
|
|
|
|
|
|
- @{article:Configuring Inbound Email} so users can reply to email they
|
|
|
|
receive about revisions and tasks to interact with them; or
|
|
|
|
- learning about daemons with @{article:Managing Daemons with phd}; or
|
2012-02-27 17:11:25 -08:00
|
|
|
- returning to the @{article:Configuration Guide}.
|