def save(self):
        super(EMailSettingsForm, self).save()

        # Reload any important changes into the Django settings.
        load_site_config()

        if self.cleaned_data['send_test_mail']:
            site = Site.objects.get_current()
            siteconfig = SiteConfiguration.objects.get_current()

            site_url = '%s://%s' % (siteconfig.get('site_domain_method'),
                                    site.domain)

            if self.request and self.request.user.is_authenticated():
                to_user = self.request.user.email
            else:
                to_user = siteconfig.get('site_admin_email')

            send_mail(_('E-mail settings test'),
                      _('This is a test of the e-mail settings for the Review '
                        'Board server at %s.') % site_url,
                      siteconfig.get('mail_default_from'),
                      [to_user],
                      fail_silently=True)
Save the form.
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/admin/forms.py/EMailSettingsForm.save