Re: Mail Failure Generated When Adding Relay Domain

Gordon Dickens <[email protected]>
Newsgroups gmane.mail.exim.vexim.devel
Message-ID <[email protected]>
On 4/13/2008 8:15 AM, Gordon Dickens wrote:
> Every time that I add a relay domain in Vexim then Vexim generates a 
> welcome email that always fails because the welcome email's addressee 
> ( rcpt to: ) has a blank local part such as:    @relaydomain.com.  Is this 
> a known bug in Vexim or have I mis-configured Vexim? 

Hello Everybody,

I figured out  the problem with the welcome message being erroneously 
generated for relay domains.  I don't know what version of Vexim that 
ya'll are running but this is definitely a bug in the version that I am 
running which is Vexim 2.2.1.  The bug is in the siteaddsubmit.php 
module.  I have fixed the php code and I will offer my fix below for the 
benefit of others that may have already experienced this bug or that may 
encounter this in the future.

I hope that you find this helpful.  I also recommend that Avleen 
consider including this fix in any future Vexim 2.x releases.

FYI,

Gordon

Here is the fix:

Near the bottom of the siteaddsubmit.php module you will find the 
following code:

      } else {
        header ("Location: site.php?added={$_POST['domain']}" .
                "&type={$_POST['type']}");
        $_SESSION['domain'] = $_POST['domain'];
        mail("{$_POST['localpart']}@{$_POST['domain']}",
              "Welcome Domain Admin!",
              "$welcome_newdomain",
              "From: {$_POST['localpart']}@{$_POST['domain']}\r\n");
        die;
      }
    } else {
      header ("Location: site.php?failaddeddomerr={$_POST['domain']}");
      die;
    }
  } else if ($_POST['type'] == "alias") {

The code that needs modifying from the above is:

} else {
        header ("Location: site.php?added={$_POST['domain']}" .
                "&type={$_POST['type']}");
        $_SESSION['domain'] = $_POST['domain'];
        mail("{$_POST['localpart']}@{$_POST['domain']}",
              "Welcome Domain Admin!",
              "$welcome_newdomain",
              "From: {$_POST['localpart']}@{$_POST['domain']}\r\n");
        die;

You can simply comment this code out to stop the erroneous welcome 
message for relay domains as follows:

/*
} else {
        header ("Location: site.php?added={$_POST['domain']}" .
                "&type={$_POST['type']}");
        $_SESSION['domain'] = $_POST['domain'];
        mail("{$_POST['localpart']}@{$_POST['domain']}",
              "Welcome Domain Admin!",
              "$welcome_newdomain",
              "From: {$_POST['localpart']}@{$_POST['domain']}\r\n");
        die;
*/

Alternatively, you can put something like this in to notify the 
postmaster at the domain for which you are relaying:

/* GLD fix: For bug in relay welcome message to blank local part. email 
to: postmaster@ <relay-to-domain> */
/*      mail("{$_POST['localpart']}@{$_POST['domain']}",  GLD removed 
this */
        mail("postmaster@{$_POST['domain']}",
              "Welcome Domain Admin!",
              "$welcome_newdomain");
/*            "From: {$_POST['localpart']}@{$_POST['domain']}\r\n");  
GLD removed this */
/* GLD fix: email from:  apache@<relay from domain>  */
        die;
      }
    } else {
      header ("Location: site.php?failaddeddomerr={$_POST['domain']}");
      die;
    }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.