From 28cce0ca37c12ced099f335c44d400858e46dbeb Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Tue, 19 Jul 2011 21:12:25 +0000 Subject: [PATCH] config.inc.php - change default of $CONF['admin_email'] to '' and updated the comment. IMPORTANT: If set, this will be used as mail sender for all mails (2.3.x used the currently logged admin's username in most cases). $CONF['admin_email'] = '' will match the 2.3.x behaviour. functions.inc.php: - new function smtp_get_admin_email() to get mail sender address ($CONF[admin_email] or currently logged in admin if not set) - changes compared to Dale's patch: - added @return in comment - switched to /** comment style This commit is part of the huge cleanup patch by Dale Blount (lnxus@SF), https://sourceforge.net/tracker/?func=detail&atid=937966&aid=3370510&group_id=191583 git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1093 a1433add-5e2c-0410-b055-b7f2511e0802 --- config.inc.php | 8 +++++--- functions.inc.php | 13 +++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/config.inc.php b/config.inc.php index 1518b423..8863f1b7 100644 --- a/config.inc.php +++ b/config.inc.php @@ -72,9 +72,11 @@ $CONF['database_tables'] = array ( ); // Site Admin -// Define the Site Admins email address below. -// This will be used to send emails from to create mailboxes. -$CONF['admin_email'] = 'postmaster@change-this-to-your.domain.tld'; +// Define the Site Admin's email address below. +// This will be used to send emails from to create mailboxes and +// from Send Email / Broadcast message pages. +// Leave blank to send email from the logged-in Admin's Email address. +$CONF['admin_email'] = ''; // Mail Server // Hostname (FQDN) of your mail server. diff --git a/functions.inc.php b/functions.inc.php index 813437a5..1f02ddc9 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -1340,6 +1340,19 @@ function smtp_mail ($to, $from, $data, $body = "") { return true; } +/** + * smtp_get_admin_email + * Action: Get configured email address or current user if nothing configured + * Call: smtp_get_admin_email + * @return String - username/mail address + */ +function smtp_get_admin_email() { + global $CONF; + if(isset($CONF['admin_email']) && !empty($CONF['admin_email'])) + return $CONF['admin_email']; + else + return authentication_get_username(); +} //