Koozali.org: home of the SME Server

Legacy Forums => Experienced User Forum => Topic started by: m4m4n_5 on August 10, 2005, 03:10:39 PM

Title: How to enabling the footer in the outgoing mail qmail on SME
Post by: m4m4n_5 on August 10, 2005, 03:10:39 PM
Dear All,

How to enabling the footer in the outgoing mail qmail on SME?

like this on link:
http://www.ornl.gov/lists/mailing-lists/qmail/2002/09/msg00440.html

Thanks
MAMAN
======================================================
Re: Append text to every sent message.

    * To: qmail@xxxxxxxxxxxxx
    * Subject: Re: Append text to every sent message.
    * From: Murat Balaban <murat@xxxxxxxxxxxxxxx>
    * Date: Wed, 11 Sep 2002 08:40:56 +0300 (EEST)
    * Delivered-to: mailing list qmail@list.cr.yp.to
    * In-reply-to: <15741.60085.71402.620671@desk.crynwr.com>
    * Mailing-List: contact qmail-help@list.cr.yp.to; run by ezmlm

Hi again,

Attached is a patch to qmail-1.03 that lets you add a footer to every
outgoing mail.

The patch appends the contents of /var/qmail/control/footer, if present,
to every outgoing mail

However be aware that it may broke the mail if it's not plain-text.

Best Regards,
- Murat

On Tue, 10 Sep 2002, Russell Nelson wrote:

> Murat Balaban writes:
>  >
>  > Hi,
>  >
>  > I want to append some text to every message that goes through
>  > my mail server.
>  >
>  > Any suggestions, pointers?
>
> Yes.  Don't do it.  The only legitimate use of a disclaimer that I've
> ever seen is on the email sent by lawyers.  So tell your lawyers to
> put the text into their signature block.
>
> --
> -russ nelson              http://russnelson.com |
> Crynwr sells support for free software  | PGPok | businesses persuade
> 521 Pleasant Valley Rd. | +1 315 268 1925 voice | governments coerce
> Potsdam, NY 13676-3213  | +1 315 268 9201 FAX   |
>

diff -uN -r qmail-1.03/qmail-remote.c qmail-1.03M/qmail-remote.c
--- qmail-1.03/qmail-remote.c   Mon Jun 15 13:53:16 1998
+++ qmail-1.03M/qmail-remote.c   Tue Sep 10 19:06:23 2002
@@ -1,4 +1,7 @@
+#include <stdio.h>
+#include <unistd.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -194,6 +197,33 @@
   int r;
   char ch;
 
+  /* Modifications starting. by murat@enderunix.org */
+  FILE *fp, *o;
+  struct stat st;
+  char *append;
+  char *inappend, *save;
+
+  if ((stat("/var/qmail/control/footer", &st)) == -1) {
+     st.st_size = 0;
+     append = NULL;
+     inappend = NULL;
+  }
+  else {
+     append = (char *)calloc(st.st_size + 2, sizeof(char));
+     inappend = (char *)calloc(st.st_size + 40, sizeof(char));
+  }
+  save = inappend;
+  if ((fp = fopen("/var/qmail/control/footer", "r")) != NULL) {
+     fread(append, st.st_size, sizeof(char), fp);
+     fclose(fp);
+   while (*append != '\0') {
+      if (*append == '\n')
+         *inappend++ = '\r';
+      *inappend++ = *append++;
+     }
+  }
+  /* Modifications ending. by murat@enderunix.org */
+
   for (;;) {
     r = substdio_get(&ssin,&ch,1);
     if (r == 0) break;
@@ -208,6 +238,12 @@
     }
     substdio_put(&smtpto,"\r\n",2);
   }
+  /* Modifications starting. by murat@enderunix.org */
+  if (save != NULL) {
+     strcat(save, "\r\n");
+     substdio_put(&smtpto, save, strlen(save));
+  }
+  /* Modifications ending. by murat@enderunix.org */
 
   flagcritical = 1;
   substdio_put(&smtpto,".\r\n",3);
Title: Re: How to enabling the footer in the outgoing mail qmail on
Post by: CharlieBrady on August 10, 2005, 05:44:29 PM
Quote from: "m4m4n_5"

How to enabling the footer in the outgoing mail qmail on SME?


It's a bad idea. Don't do it. As the quoted text says, the added text can break messages. "Standard footers" are just a waste of your time and everybody else's anyway.

For the record, qmail is very careful never to change the contents of any message. It just moves the message from sender to receiver.
Title: Re: How to enabling the footer in the outgoing mail qmail on
Post by: m4m4n_5 on August 15, 2005, 05:52:52 AM
Hi CharlieBrady,

Thanks for your comment, does any solution?

Maman Sulaeman

Quote from: "CharlieBrady"
Quote from: "m4m4n_5"

How to enabling the footer in the outgoing mail qmail on SME?


It's a bad idea. Don't do it. As the quoted text says, the added text can break messages. "Standard footers" are just a waste of your time and everybody else's anyway.

For the record, qmail is very careful never to change the contents of any message. It just moves the message from sender to receiver.