From 519c542b70d7de95cfc92c94f724d4e55e9e1e90 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Fri, 16 Feb 2007 16:06:47 +0000 Subject: [PATCH] Implemented 'Default email from' SVN revision: 1790 --- doc/config.html | 10 +++++++--- src/elogd.c | 7 +++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/config.html b/doc/config.html index 3be796b4..8f9bf6e6 100755 --- a/doc/config.html +++ b/doc/config.html @@ -2056,6 +2056,9 @@ Options Location = Main Building{a}, New Building{b}, Old Building{c}
  • Use Email From = <string>
  • +
  • + Default Email From = <string> +
  • Use Email Heading = <string>
  • @@ -2115,11 +2118,12 @@ Options Location = Main Building{a}, New Building{b}, Old Building{c} for the "From:" field in the email. Since more and more email servers do not accept invalid "From:" addresses in order to reduce spam mail, it might be important that a "real" email address is used in - the "From:" field. By default, the email address of the currently + the "From:" field. If Use Email From is + present, it is always used. If not, the email address of the currently logged in user is used for the "From:" field. If no user is logged in, or the current user has not specified a email address in the password - database, the setting of the option Use Email From is - used for the "From:" field. Only if this option is not specified, + database, the setting of the option Default Email From + is used for the "From:" field. Only if this option is not specified, a generic address ELOG@<hostname> is used, which might be rejected by the SMTP server however.

    diff --git a/src/elogd.c b/src/elogd.c index e6b6f1bb..974eea9c 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -3386,13 +3386,16 @@ void retrieve_email_from(LOGBOOK * lbs, char *ret, char *ret_name, char attrib[M char slist[MAX_N_ATTR + 10][NAME_LENGTH], svalue[MAX_N_ATTR + 10][NAME_LENGTH]; int i; - if (isparam("full_name") && isparam("user_email")) { + if (getcfg(lbs->name, "Use Email from", str, sizeof(str))) { + strlcpy(email_from, str, sizeof(email_from)); + strlcpy(email_from_name, str, sizeof(email_from)); + } else if (isparam("full_name") && isparam("user_email")) { strlcpy(email_from_name, getparam("full_name"), sizeof(email_from_name)); strlcat(email_from_name, " <", sizeof(email_from_name)); strlcat(email_from_name, getparam("user_email"), sizeof(email_from_name)); strlcat(email_from_name, ">", sizeof(email_from_name)); strlcpy(email_from, getparam("user_email"), sizeof(email_from)); - } else if (getcfg(lbs->name, "Use Email from", str, sizeof(str))) { + } else if (getcfg(lbs->name, "Default Email from", str, sizeof(str))) { strlcpy(email_from, str, sizeof(email_from)); strlcpy(email_from_name, str, sizeof(email_from)); } else {