diff --git a/reviewboard/admin/forms.py b/reviewboard/admin/forms.py
index aba3cc45cf8c03e7378dc5ff4865e149904c7cc7..4467363c84a51628c5967fae784f97b39ef8535d 100644
--- a/reviewboard/admin/forms.py
+++ b/reviewboard/admin/forms.py
@@ -463,6 +463,10 @@ class EMailSettingsForm(SiteSettingsForm):
         label=_("Use TLS for authentication"),
         required=False)
 
+    def clean_mail_host(self):
+        # Strip whitespaces from the SMTP address.
+        return self.cleaned_data['mail_host'].strip()
+
     def save(self):
         super(EMailSettingsForm, self).save()
 
