DOC Add email section to server requirements

This commit is contained in:
Steve Boyd 2021-08-24 10:53:22 +12:00
parent 92f47da08b
commit a2f850d65f
2 changed files with 30 additions and 0 deletions

View File

@ -248,6 +248,22 @@ Additionally, there are community supported guides for installing Silverstripe C
* [Vagrant with silverstripe-australia/vagrant-environment](https://github.com/silverstripe-australia/vagrant-environment) * [Vagrant with silverstripe-australia/vagrant-environment](https://github.com/silverstripe-australia/vagrant-environment)
* [Vagrant with BetterBrief/vagrant-skeleton](https://github.com/BetterBrief/vagrant-skeleton) * [Vagrant with BetterBrief/vagrant-skeleton](https://github.com/BetterBrief/vagrant-skeleton)
### Email
Silverstripe CMS uses SwiftMailer to send email messages. New installations setup with silverstripe/installer are configured to use a `sendmail` found in `/usr/sbin/sendmail` or another location specified via configuration. Alternatively email can be configured to use SMTP or other mail transports instead of sendmail.
You _must_ ensure emails are being sent from your _production_ environment. You can do this by testing that the ***Lost password*** form available at `/Security/lostpassword` sends an email to your inbox, or with the following code snippet that can be run via a `SilverStripe\Dev\BuildTask`:
```php
$email = new SilverStripe\Control\Email\Email('no-reply@mydomain.com', 'myuser@gmail.com', 'My test subject', 'My email body text');
$email->send();
```
Using the code snippet above also tests that the ability to set the "from" address is working correctly.
See the [email section](/developer_guides/email) for futher details, including how to set the administrator "from" email address, change the `sendmail` binary location and how to use SMTP or other mail transports instead of sendmail.
## PHP Requirements for older Silverstripe CMS releases {#php-support} ## PHP Requirements for older Silverstripe CMS releases {#php-support}
Silverstripe CMS's PHP support has changed over time and if you are looking to upgrade PHP on your Silverstripe CMS site, this Silverstripe CMS's PHP support has changed over time and if you are looking to upgrade PHP on your Silverstripe CMS site, this

View File

@ -94,6 +94,18 @@ SilverStripe\Core\Injector\Injector:
0: '/usr/bin/env catchmail -t' 0: '/usr/bin/env catchmail -t'
``` ```
### Testing that email works
You _must_ ensure emails are being sent from your _production_ environment. You can do this by testing that the
***Lost password*** form available at `/Security/lostpassword` sends an email to your inbox, or with the following code snippet that can be run via a `SilverStripe\Dev\BuildTask`:
```php
$email = new Email('no-reply@mydomain.com', 'myuser@gmail.com', 'My test subject', 'My email body text');
$email->send();
```
Using the code snippet above also tests that the ability to set the "from" address is working correctly.
## Usage ## Usage
### Sending plain text only ### Sending plain text only
@ -201,6 +213,8 @@ Remember, setting a `from` address that doesn't come from your domain (such as t
email marked as spam. If you want to send from another address think about using the `setReplyTo` method. email marked as spam. If you want to send from another address think about using the `setReplyTo` method.
[/alert] [/alert]
You will also have to remove the `SS_SEND_ALL_EMAILS_FROM` environment variable if it is present.
## Redirecting Emails ## Redirecting Emails
There are several other [configuration settings](/developer_guides/configuration) to manipulate the email server. There are several other [configuration settings](/developer_guides/configuration) to manipulate the email server.