Tom Collins wrote:

On Friday, October 17, 2003, at 05:27 PM, David Bristol wrote:

This may not be the way to go about this, but have you verified that
both domains are in the qmail/control/locals file?


Don't put vpopmail domains in control/locals. You'll mess things up.

There isn't a known solution to what was asked. Doublebounces go to the postmaster of the server. Bounce messages refer to the name of the physical server, and not the domain name.

You might be able to modify qmail-send, but it would be very difficult to determine what hostname to use in the bounce message.

There's actually a patch to qmail-send that does this, I've attached it to this mail. It was originally posted on the qmail-list if I remember correctly. I've been using it for over a year, and it appears to work fine. But I'm not the author - if it doesn't work for you, don't blame me.


What if there are multiple recipients that bounced?

Then there are multiple bounce messages.


What if it's a message one of your user's is trying to send to a hotmail address? You don't want it to say that your server is hotmail.com.

Well, I'm no expert - but the local mail server should only generate bounces it the mail is directed to one of the local domains. Otherwise, it should either not accept the mail at all, or relay it to the appropriate MX. If this MX can't deliver the mail, it will generate a bounce message on its own.


Regards
Jochen
--- qmail-send.c.orig   Tue Jun 11 17:59:23 2002
+++ qmail-send.c        Tue Jun 11 17:59:36 2002
@@ -193,6 +193,37 @@
 }
 
 
+int recipdomain(rd,fn2)
+stralloc* rd;
+stralloc fn2;
+{
+ int fd;
+ int ret = 0;
+ 
+ fd = open_read(fn2.s);
+ if (fd != -1)
+  {
+   int r;
+   char inbuf[128];
+   char buf[2];
+   substdio ssread;
+ 
+   buf[0] = 0; buf[1] = 0;
+   substdio_fdbuf(&ssread,read,fd,inbuf,sizeof(inbuf));
+   while (((r = substdio_get(&ssread,buf,1)) > 0) && (buf[0] != '@'));
+   if (buf[0] == '@')
+    {
+      while (((r = substdio_get(&ssread,buf,1)) > 0) && (buf[0] != '>'))
+        stralloc_cats(rd,buf);
+      stralloc_0(rd);
+      ret = (buf[0] == '>');
+    }
+   close(fd);
+  }
+  return ret;
+}
+ 
+ 
 /* this file is too long ---------------------------------------------- INFO */
 
 int getinfo(sa,dt,id)
@@ -659,8 +690,10 @@
  char inbuf[128];
  static stralloc sender = {0};
  static stralloc quoted = {0};
+ stralloc rdomain = {0};
  datetime_sec birth;
  unsigned long qp;
+ int rd = 0;
 
  if (!getinfo(&sender,&birth,id)) return 0; /* XXX: print warning */
 
@@ -685,6 +718,10 @@
    log3("triple bounce: discarding ",fn2.s,"\n");
  else
   {
+   rd = recipdomain(&rdomain,fn2);
+   if (rd)
+     log3("modified bouncehost: '", rdomain.s, "'\n");
+
    if (qmail_open(&qqt) == -1)
     { log1("warning: unable to start qmail-queue, will try later\n"); return 0; }
    qp = qmail_qp(&qqt);
@@ -698,7 +735,10 @@
    while (!quote(&quoted,&bouncefrom)) nomem();
    qmail_put(&qqt,quoted.s,quoted.len);
    qmail_puts(&qqt,"@");
-   qmail_put(&qqt,bouncehost.s,bouncehost.len);
+   if (rd)
+     qmail_put(&qqt,rdomain.s,rdomain.len);
+   else
+     qmail_put(&qqt,bouncehost.s,bouncehost.len);
    qmail_puts(&qqt,"\nTo: ");
    while (!quote2(&quoted,bouncerecip)) nomem();
    qmail_put(&qqt,quoted.s,quoted.len);
@@ -706,7 +746,10 @@
 Subject: failure notice\n\
 \n\
 Hi. This is the qmail-send program at ");
-   qmail_put(&qqt,bouncehost.s,bouncehost.len);
+   if (rd)
+     qmail_put(&qqt,rdomain.s,rdomain.len);
+   else
+     qmail_put(&qqt,bouncehost.s,bouncehost.len);
    qmail_puts(&qqt,*sender.s ? ".\n\
 I'm afraid I wasn't able to deliver your message to the following addresses.\n\
 This is a permanent error; I've given up. Sorry it didn't work out.\n\

Reply via email to