Printable Version of Topic
Click here to view this topic in its original format
XMail Forum > XMail Server > Xmail Generates Bounce Messages

Posted by: MaartenJB May 22 2007, 10:07 AM
Hello, I've got a problem with bounce messages that are being returned to sender. When the address on the next mailserver does not exist, xmail generates a bounce message.

This is my

"RootDomain"    ""
"SmtpServerDomain"      ""
"POP3Domain"    ""
"HeloDomain"    ""
"PostMaster"    ""
"ErrorsAdmin"   ""
"RemoveSpoolErrors"     "0"
"NoSenderBounce"        "1"
"NotifyTryPattern"      ""
"MaxMTAOps"     "16"
"ReceivedHdrType"       "0"
"FetchHdrTags"  "+X-Deliver-To,+Received,To,Cc"
"MaxMessageSize"        "6000"
"AllowNullSender"       "0"
"DefaultSmtpPerms"      "MRVZ"


Posted by: hschneider May 22 2007, 10:56 AM
"NoSenderBounce" "0"

Posted by: MaartenJB May 23 2007, 08:34 AM
Thanks for the response. I'm going to test this setting, but this is what the manual says:


When building bounce messages, use the null SMTP sender ('MAIL FROM:<>') instead of the 'PostMaster' address. This will affect only the SMTP sender, while the message RFC822 headers will still contain the correct From: header.

I did see the option too, and "NoSenderBounce" is what I want. But when I read the manual, the explanation didn't make sence.

Posted by: MaartenJB Jul 3 2007, 10:31 AM
This is what I find in the XMail Queue Manager. The Senders address is incorrect, probably because of the space after the address. But why is this mail being generated? That shoud not happen right?

[]:0;[]:0;Thu, 28 Jun 2007 04:56:14 +0200
Date:   Thu, 28 Jun 2007 04:56:14 +0200
X-MessageId: <1182999374435.2792213392.5031e.lnxsrv2>
X-SmtpMessageId: <S12E183>
From: PostMaster <>
Subject: Error sending message [1182999374435.2792213392.5031e.lnxsrv2] from []
X-MailerServer: XMail 1.23
X-MailerError: Message = [1182999374435.2792213392.5031e.lnxsrv2] Server = []

[<00>] XMail bounce: Rcpt=[];Error=[501 Address Syntax Error in < > SIZE=1642]

[<01>] Error sending message [1182999374435.2792213392.5031e.lnxsrv2] from [].

ID:        <S12E183>
Mail From: < >
Rcpt To:   <>
Server:    <> []

[<02>] The reason of the delivery failure was:

501 Address Syntax Error in < > SIZE=1642

[<05>] Here is listed the initial part of the message:

Received: from ([]:1777)
by with [XMail 1.23 ESMTP Server]
id <S12E183> for <> from <>;
Thu, 28 Jun 2007 04:56:13 +0200
Received: from yesterdaynowzzz (HELO dementiahost.localleander)
 by with WQMTP; Thu, 28 Jun 2007 08:41:52 +0500
Date: Wed, 27 Jun 2007 21:36:52 -0600
Message-Id: <>
From: "Shawn Perez" < >
Subject: monogamy, bet and win casino Royal
X-Scanner: prone for cyclopean (
X-Virus-Scanner: AMaVis 0.2.0-pre6 / Virus Scan
Mime-Version: 1.0
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 7bit

this is my server configuration:

"RootDomain"    ""
"SmtpServerDomain"      ""
"POP3Domain"    ""
"HeloDomain"    ""
"PostMaster"    ""
"ErrorsAdmin"   ""
"RemoveSpoolErrors"     "0"
"NoSenderBounce"        "0"
"MaxMTAOps"     "16"
"ReceivedHdrType"       "0"
"FetchHdrTags"  "+X-Deliver-To,+Received,To,Cc"
"MaxMessageSize"        "6000"
"AllowNullSender"       "0"
"DefaultSmtpPerms"      "MRVZ"

Posted by: hschneider Jul 3 2007, 12:02 PM


Mail From: < >

Remove the space after the recipient address and check again. XQM's SLOG file to this message would be helpful. Trying this server manually shows that it probes the sender against several antispam rules. So If your domain does not match all criteria, the connection will be dropped:

This gives you the recipient's MX:

This is a telnet session with this server:


$ telnet 25
Connected to
Escape character is '^]'.
220 ESMTP Postfix
helo test
mail from: <>
250 Ok
rcpt to: <>
550 <test>: No thank you rejected: Mail refused: See
rcpt to: < >
550 <test>: No thank you rejected: Mail refused: See
421 Error: timeout exceeded
Connection closed by foreign host.

Please post the SLOG if possible.

Posted by: MaartenJB Jul 3 2007, 01:05 PM
Just to be sure, I don't want this message to be sent, because it is spam. I want to prevent bounce messages from being sent back to the spammer.

This is the SLOG from XQM:

[PeekTime] 1183453970 : Tue, 3 Jul 2007 11:12:50 +0200
ErrCode   = -40
ErrString = Invalid server address
ErrInfo   =
SMAIL SMTP-Send FF = " " SMTP = "" From = "" To = " " Failed !
SMTP-Error = "417 Temporary delivery error"
SMTP-Server = " "

Posted by: hschneider Jul 3 2007, 01:12 PM
I see ... clear ErrorsAdmin and TempErrorsAdmin in


        The email address that receives notification messages for every
        message that has had delivery errors. If it is empty (allowed), the
        notification message is sent to the sender only.

        The email address that receives notification for temporary delivery
        failures. In case it's empty the notification message is sent to the
        sender only.

Posted by: MaartenJB Jul 3 2007, 01:56 PM
Thanks, I'm going to try that one. But when I read the discription of the two settings, than this is not wat I want. I want no bounce/error message to be sent to anyone. Especially not to the sender. (spammer)


Posted by: jdsmith Jul 5 2007, 01:48 PM

Just so that I understand... what is the problem with 'bounced' messages being returned to the message originator when the recipient address is rejected at the destination mail server?

I would think that this is reasonable behaviour.

But, the reason I ask this question is that I do not understand the reply... which I hope will add to my general knowledge.

The answer was... "NoSenderBounce" "0"

This should mean, when xMail Server creates 'bounced NDR messages' use a NULL Sender Address.


So for clarification, what is the problem that you are experiencing??

Posted by: MaartenJB Feb 21 2008, 12:47 PM
Sorry for the VERY late response.

The reason why I don't want the mailserver to send a notification error is because this would let the spammer know the message is received.

This causes the spammer to send even more spam. The second problem is, the spammer can use an address that is valid, but not his own. The "victum" the address belongs to receives all the notification errors. In this case my mailserver is generating a lot of "spam", and this can get me blacklisted.

I tried al the suggestions mentioned, but none seem to work.

Posted by: GGGss Mar 12 2008, 10:25 AM
Any solutions yet regarding this topic?
If there is a flaw in combatting spam the 'absolute no bounce' option would work great.

I see that spammers are using bogus return adresses just to waste bandwidth and processor time.


Posted by: hschneider Mar 14 2008, 08:09 AM
You could create a custom filter which stops all bouncing messages in

Posted by: MaartenJB May 22 2008, 05:35 PM
Hi, I'm willing to give this filter a try. Do you maybe have a small example for me? Or point me in the right direction?

Thanks in advance

Posted by: hschneider May 24 2008, 07:39 AM
Check the presence of "X-MailerServer: XMail" and "X-MailerError:" in each outgoing mail's header. If found, reject the message and stop further filters.

Posted by: sc4vengr Jun 11 2008, 10:14 PM
Today, SpamCop decided to black list my server because it sends out bounce message as it should.

If this can help anyone, I have just finished my script to prevent XMAIL to send any bounce message except when RCPT is 2 addresses that I have specified in the code, it may not be perfect but it works.






* MailAntibounce
* @author scav
* @copyright Copyright 2008
* @version 1.0
* @access public

class MailAntibounce {
   var $_logDir = '/mailsrv/MailRoot/logs/';
   var $_file;
   var $_mail = '';
   var $_time_start;
   var $_drop_code = 4;
   var $_ok_code = 0;
   var $_writeLog = true;
   var $_filter_bypass = false;
   var $_to = '';

    * MailAntibounce::MailAntibounce()
    * @param mixed $pArg1 Mail file
    * @param mixed $pArg2 To
   function MailAntibounce($pArg1, $pArg2)
       $mtime = explode(" ", microtime());
       $this->_time_start = $mtime[1] + $mtime[0];

       $this->_file = $pArg1;
       $this->_to = $pArg2;

       if ($this->_filter_bypass == true) {
           $this->printLog("Bypassed", $this->_ok_code);

       if ($this->_to == "") {
           $this->printLog("Whitelisted TO (", $this->_ok_code);

       if ($this->_to == "") {
           $this->printLog("Whitelisted TO (", $this->_ok_code);


       if ($this->readMailError()) {
           $this->printLog("BOUNCE DETECTED, DROPPING MAIL", $this->_drop_code);
       } else {
           $this->printLog("OK", $this->_ok_code);

    * MailAntibounce::getMail()
    * Charge le mail
   function getMail()
       if (file_exists($this->_file)) {
           $fp = fopen($this->_file, 'r');
           while (!feof($fp)) {
               $this->_mail .= fgets($fp);
       } else {
           $this->printLog("FILE ERROR(2)", $this->_ok_code);

   function printLog($pStatus = 'OK', $pExitCode = 0)
       if ($this->_writeLog) {
           $filename = $this->_logDir . 'antibounce-' . date('Ymd') . '0000';
           $handle = fopen($filename, 'a+');
           fwrite($handle, date('Y-m-d H:i:s') . "\t"
                . $this->_to . "\t"
                . $pExitCode . "\t"
                . $this->getProcessingTime() . "\t"
                . $pStatus . "\n");

   function readMailError()
       $mailerServer = strpos($this->_mail, 'X-MailerServer:');
       $mailerError = strpos($this->_mail, 'X-MailerError:');
       if ($mailerServer && $mailerError) {
           return true;
       } else {
           return false;

   function getProcessingTime()
       $mtime = explode(" ", microtime());
       $time_stop = $mtime[1] + $mtime[0];
       return round($time_stop - $this->_time_start, 4);
// Si ca chi, uncomment this line:
// exit(0);
$mail = new MailAntibounce($argv[1], $argv[2]);
// $mail = new MailAntibounce('mail.txt', 'saf');



Posted by: voigt Jun 12 2008, 12:52 AM
Here's what was working for me until I upgraded to 1.25 (note this probably has nothing to do with my problem with 1.25 and should work there too):
Create a postmaster account called for example postxmaster. Point all postmaster related entries at it. Create a null file called in it's mail directory. No more bounce messages.

Why do this? Spammers send spam to my server to a non-existent user with a return address of the target spam victim. If you allow xmail to send out "message undeliverable notifications", the spammers spam will be delivered back to where xmail "thinks" it came from, thus spamming the faked from address.

If there's a better, easier way (filters are not easier and probably generate a lot of unnecessary overhead) I'd love to know. We really need a "never, ever send any postmaster mail off the local lan" flag in As been mentioned elsewhere, spamcop will put you in banned lists if you bounce spammers messages for them. They have "honey pots" all over that look for postmaster messages.

Posted by: pepsi Jun 12 2008, 12:43 PM
Just a quistion beside.

at my work we use a mailrelay server. This server does during the handshake if the recipient mail address exists. If not the connection is closed. So the sending mailserver is responsible for sending the NDR.
In this way not my ip address is blacklisted but the server that is sending spam.

Is this an option for Xmailserver ?

Posted by: hschneider Jun 13 2008, 08:52 AM
Voigt, pls forward this feature request direclty to Davidel at
Pepsi, this will fail when the recipient has catchall accounts ....

Posted by: voigt Sep 11 2008, 12:31 PM
Further research reveals the following: These e-mails (which originate from my mail server) are created by xmail with a null sender "<>". They are bounce messages. I cannot find any way to be rid of them. Maybe someone has an idea. (I have messaged Davide.)

My server (call it m1) acts as a secondary MX for another domain (m2). The other domain is running xmail 1.24.

domain m2 has the following users: u1, u2 and u3.

Spammer sends mail to fakeuser@m2 with a faked sender address of spamtarget@someotherdomain. This e-mail is sent to my server (m1).
My server attempts to relay it to m2 like a good secondary should. Unfortunately, m2 won't ever accept it because it has no user fakeuser@m2. Eventually m1 gives up trying to relay the message, applys a bounce message from <> to the front and "returns" it to the "sender" spamtarget@someotherdomain. So our clever spammers have found a way to relay their crap through my server.

I'd really like to stop this. I've temporarily removed my backup MX records for my friends domain. I hope there's some other way to fix this.


Posted by: voigt Sep 12 2008, 01:35 AM
Here's Davide's reply:

Feed the backup MX with the proper accounts handled by the primary MX.
This is typically done by creating one cmdalias file for every account,
having an "smtprelay" line pointing to the real MTA.
This better be scripted, and done automatically, for your sake.
No, I don't have the scripts (since I have no need for them), and people
that wrote them were not willing to share them.

- Davide

I guess xmail's just not meant to be a reasonable secondary server.


Posted by: Sob Sep 12 2008, 08:23 PM
I tried the following and it seems to work just fine:

Primary server:, XMail, Win32
Secondary server:, XMail, Linux

Primary server has regular domain with all accounts.
Secondary server has also regular domain (not custom domain) but with no acccounts.

update-accounts.bat goes to primary server, update-accounts.php goes to secondary server.

To synchronize accounts, just to run update-accounts.bat is required.

It doesn't handle disabled acccounts. Getting the list of accounts from XMail would have to be modified for that.


CtrlClnt -s -u ctrluser -p password -f users.txt "userlist"[TAB]""
CtrlClnt -s -u ctrluser -p password -f aliases.txt "aliaslist"[TAB]""
pscp.exe -agent users.txt aliases.txt
plink.exe -agent update-accounts.php

Replace [TAB] by real tab.
pscp.exe and plink.exe are part of PuTTY (


 $mailroot="/var/MailRoot"; #XMail root
 $dataroot="/tmp"; #where txts are uploaded
 $domain=""; #domain name
 $relayto=""; #where to relay mail to
 if($dh=opendir($mailroot.'/cmdaliases/'.$domain)) {
   while(($account=readdir($dh))!==false) {
     if(preg_match("/^([a-z0-9\-\.]+)\.tab$/", $account, $matches)) {
 foreach(Array('users.txt', 'aliases.txt') as $file) {
   foreach($data as $line) {
     $tmp=explode("\t", $line);
     if($tmp[0]=="\"".$domain."\"") {
       $user=substr($tmp[1], 1, strlen($tmp[1])-2);
 foreach($accounts as $account=>$create) {
   if($create) {
     file_put_contents($file, $tabfile);
   } else {

Posted by: voigt Sep 13 2008, 12:14 AM

I really appreciate you going to the trouble of writing those scripts and I hope they help someone. I can't really use them because I was acting as a secondary for 14 different domains (2 of whom also do secondary for domains that I host) and on top of being cumbersome, it's less secure than a simple custom domain. It also requires that additional control ports be opened in the firewall (or at least ssh ports for putty) which is not really an option I'd like to explore.

I'm looking at other solutions for the secondary servers that don't require knowledge of the individual accounts and yet won't relay spam.

Obviously, a "don't ever send e-mail from "<>" or postmaster" feature would solve my problem but I surely won't complain about something that Davide's given us for free. I suspect my situation is pretty unique anyway.

Thanks again,


Posted by: RoxXxer Sep 15 2015, 08:21 AM
I want to stop sending bounce mail to Postmaster. It should be sent only to the sender .How can I do that ?

sad.gif mellow.gif

Powered by Invision Power Board (
© Invision Power Services (