From: serassio <> Date: Sat, 3 Sep 2005 17:53:31 +0000 (+0000) Subject: Bug #1380: E-mail sent when cache dies is blocked from many antispam rules X-Git-Tag: SQUID_3_0_PRE4~648 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=abacf7768798c5e4d190a19f1a19ab2ddcc96aa3;p=thirdparty%2Fsquid.git Bug #1380: E-mail sent when cache dies is blocked from many antispam rules The e-mail sent when the cache dies use as "From:" field the Squid internal appname "squid". This "From:" address is invalid for the majority of antispam filters because doesn't contains a valid domain name. This patch adds the 'mail_from' directive to squid.conf, allowing to specify the from e-mail address and change the default to use 'appname@unique_hostname'. --- diff --git a/src/cf.data.pre b/src/cf.data.pre index f774fc2584..2553363f80 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.393 2005/09/01 19:34:46 hno Exp $ +# $Id: cf.data.pre,v 1.394 2005/09/03 11:53:31 serassio Exp $ # # # SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -2930,6 +2930,18 @@ DOC_START DOC_END +NAME: mail_from +TYPE: string +DEFAULT: none +LOC: Config.EmailFrom +DOC_START + From: email-address for mail sent when the cache dies. + The default is to use 'appname@unique_hostname'. + Default appname value is "squid", can be changed into + src/globals.h before building squid. +DOC_END + + NAME: mail_program TYPE: eol DEFAULT: mail diff --git a/src/structs.h b/src/structs.h index 714191889f..e3a4d759ab 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.524 2005/08/31 19:15:36 wessels Exp $ + * $Id: structs.h,v 1.525 2005/09/03 11:53:32 serassio Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -383,6 +383,7 @@ struct _SquidConfig Log; char *adminEmail; + char *EmailFrom; char *EmailProgram; char *effectiveUser; char *visible_appname_string; diff --git a/src/tools.cc b/src/tools.cc index 02a330e37e..e5488c5cd9 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.259 2005/08/27 19:36:36 serassio Exp $ + * $Id: tools.cc,v 1.260 2005/09/03 11:53:32 serassio Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -120,7 +120,10 @@ mail_warranty(void) #endif - fprintf(fp, "From: %s\n", appname); + if (Config.EmailFrom) + fprintf(fp, "From: %s\n", Config.EmailFrom); + else + fprintf(fp, "From: %s@%s\n", appname, uniqueHostname()); fprintf(fp, "To: %s\n", Config.adminEmail);