]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Fixing class MailConfiguration in module pp_admintools.mail_config
authorFrank Brehm <frank@brehm-online.com>
Wed, 18 May 2022 11:41:44 +0000 (13:41 +0200)
committerFrank Brehm <frank@brehm-online.com>
Wed, 18 May 2022 11:41:44 +0000 (13:41 +0200)
lib/pp_admintools/mail_config.py

index 563f5c717d32f3592df1008f2f66886901dbb2e8..3754b49f558cc64bbe902a3efc1d3698c29ce1cc 100644 (file)
@@ -34,12 +34,13 @@ from . import MAX_PORT_NUMBER, DEFAULT_CONFIG_DIR
 
 from .xlate import XLATOR
 
-__version__ = '0.1.9'
+__version__ = '0.1.10'
 LOG = logging.getLogger(__name__)
 
 _ = XLATOR.gettext
 
 VALID_MAIL_METHODS = ('smtp', 'sendmail')
+DEFAULT_DOMAIN = 'pixelpark.com'
 
 
 # =============================================================================
@@ -68,10 +69,13 @@ class MailConfiguration(BaseMultiConfig):
 
     default_mail_server = 'localhost'
     default_smtp_port = 25
+    default_domain = socket.getfqdn()
+    if not default_domain:
+        default_domain = DEFAULT_DOMAIN
 
     current_user_name = pwd.getpwuid(os.getuid()).pw_name
     current_user_gecos = pwd.getpwuid(os.getuid()).pw_gecos
-    default_mail_from = MailAddress(user=current_user_name, domain=socket.getfqdn())
+    default_mail_from = MailAddress(user=current_user_name, domain=default_domain)
     default_mail_from_complete = '{n} <{m}>'.format(n=current_user_gecos, m=default_mail_from)
 
     valid_mail_methods = VALID_MAIL_METHODS