Print Page | Close Window

Exception occurred during RECEIVEMESSAGE

Printed From: LogSat Software
Category: Spam Filter ISP
Forum Name: Spam Filter ISP Support
Forum Description: General support for Spam Filter ISP
URL: http://www.logsat.com/spamfilter/forums/forum_posts.asp?TID=6561
Printed Date: 20 October 2017 at 8:31am


Topic: Exception occurred during RECEIVEMESSAGE
Posted By: Hassan
Subject: Exception occurred during RECEIVEMESSAGE
Date Posted: 30 September 2008 at 4:38am
Hi all,

We are running SpamFilter V.4.0.1.783 and one of the employee complain that one mail is not received and the sender receive the  NDR:

xxx@xx.xx : host xx.xxxx.xx [xxx.xxx.xxx.xxx] said: 557 The
   server encountered an error while processing this message. Please retry
   later. (in reply to end of DATA command)


When I check the log, I have this entry:


09.29.08 19:54:54:739 -- (720) Received MAIL FROM: mailto:info@helmut-ament.de - xxxxx
09.29.08 19:54:54:739 -- (720) Received RCPT TO: xxxxx
09.29.08 19:54:54:739 -- (720) Bypassed all rules for: mailto:ament@worldsoft.ch - xxxxxx from xxxxx mailto:info@helmut-ament.de - ( Whitelisted Peer IP)
09.29.08 19:54:54:739 -- (720) Exception occurred during RECEIVEMESSAGE: ( 1 2 2b 3 3a 4 111) '$?a' is not a valid integer value --
09.29.08 19:54:54:755 -- (720) Disconnect
This is the reason why the mail was not received at xxxxx



Any idea about this error message?


Regards,


-------------
Worldsoft



Replies:
Posted By: LogSat
Date Posted: 30 September 2008 at 11:04pm
Hassan,

From the error it looks like the message has invalid/corrupted email headers. If this is the case, SpamFilter will always reject the email as it can't be processed. If you can have access to this email in a different way and forward it to us we can double-check to ensure there is nothing else that may be wrong.

-------------
Roberto Franceschetti

http://www.logsat.com" rel="nofollow - LogSat Software

http://www.logsat.com/sfi-spam-filter.asp" rel="nofollow - Spam Filter ISP


Posted By: Hassan
Date Posted: 15 October 2008 at 8:57am
Hello Roberto,

Sorry for the delay, but I don't have the headers.


-------------
Worldsoft


Posted By: atifghaffar
Date Posted: 12 February 2009 at 5:53am
Hi Roberto,
I sent the same mail that hassan is talking about to a gmail address and it arrives there.

Here are the headers
From: "XYZ" <info@xyzde>
To: "Atif Ghaffar" <atif.ghaffar@abccom>
Subject: =?iso-8859-1?Q?Insider-Geheimnis=20f=FCr=20die=20Verdoppelung=20oder=20Verdreifachung=20Ihres=20Umsatze=?s!?=

The subject without encoding is :
Insider-Geheimnis für die Verdoppelung oder Verdreifachung Ihres Umsatzes!

If I replace the ü with u then the message goes though.

If I keep the umlaut character and shorten the subject then the message goes through too.
For example:
Subject: Insider-Geheimnis für
Encoded: Subject: =?iso-8859-1?Q?Insider-Geheimnis=20f=FCr?=

Thanks for looking into it. We have many customers from different countries who use different umlauts which must be encoded.

best regards
--
Atif



-------------
best regards

Atif


Posted By: atifghaffar
Date Posted: 12 February 2009 at 5:55am
Also this one works too.
Subject: Insider-Geheimnis für Vervielfachung Ihres Internet-Umsatzes!
Encoded:
 =?iso-8859-1?Q?Insider-Geheimnis=20f=FCr=20Vervielfachung=20Ihres=20Internet-Umsatzes!?=

-------------
best regards

Atif


Posted By: LogSat
Date Posted: 12 February 2009 at 6:31pm
Atif,

We're able to replicate this, and is obviously related to the encoding. Please allow us a short time to pinpoint the issue, I'll update this post as soon as we have a solution/fix.

-------------
Roberto Franceschetti

http://www.logsat.com" rel="nofollow - LogSat Software

http://www.logsat.com/sfi-spam-filter.asp" rel="nofollow - Spam Filter ISP


Posted By: Gary Winnick
Date Posted: 13 February 2009 at 1:09am
oh its great I will try it.


Posted By: LogSat
Date Posted: 14 February 2009 at 12:28am
Atif,

I'm afraid the problem looks like the subject has an incorrect ISO encoding. The source you posted to the thread is:

Subject: =?iso-8859-1?Q?Insider-Geheimnis=20f=FCr=20die=20Verdoppelung=20oder=20Verdreifachung=20Ihres=20Umsatze=?s!?=

However the text after the "=" sign must be two hexadecimal characters (0-9, a-f). In the sample above, it's ?s, which is invalid, and causes SpamFilter to reject the email due to an exception.

If in the Subject line above you replace the

Umsatze=?s!?=

with

Umsatzes!?=

then everything should be fine (the ?= indicates the end of the encoding).

So far this seems unrelated to the umlaut that appears at the beginning of the email.

Please however do let me know if you believe this is incorrect, or if the copy/paste operation in the forum does not result in the same email's source that is having the problem. Encodings are tricky, and it is possible I may be missing something here.


-------------
Roberto Franceschetti

http://www.logsat.com" rel="nofollow - LogSat Software

http://www.logsat.com/sfi-spam-filter.asp" rel="nofollow - Spam Filter ISP


Posted By: atifghaffar
Date Posted: 16 February 2009 at 4:06am
Roberto. Thanks.

We are using ZendFramework for the mail and this is the library that encodes the subject.
So Zend_Mail encodes the header, which uses Zend_Mime to do some stuff.

It seems that Zend_Mime, breaks the subject line at 74 characters for folding.

So here is the breakdown.
Normal Text:
Insider-Geheimnis für die Verdoppelung oder Verdreifachung Ihres Umsatzes!

Text after Zend_Mime does the splitting (note on two lines)
Insider-Geheimnis f=FCr die Verdoppelung oder Verdreifachung Ihres Umsatze=
s!


Text after Zend_Mime does the quote-pritable stuff (note on two lines)
Insider-Geheimnis=20f=FCr=20die=20Verdoppelung=20oder=20Verdreifachung=20Ihres=20Umsatze=
s!

Text after Zend_Mail encodeHeader stuff (note, still on two lines)
=??Q?Insider-Geheimnis=20f=FCr=20die=20Verdoppelung=20oder=20Verdreifachung=20Ihres=20Umsatze=
s!?=

Does any of this give any more clue? Is this a valid format?

best regards



-------------
best regards

Atif


Posted By: atifghaffar
Date Posted: 16 February 2009 at 4:24am
Here is the function that does the Quoted_Printable thing. which some print commands from me to show the result.
/**
* Encode a given string with the QUOTED_PRINTABLE mechanism
*
* @param string $str
* @param int $lineLength Defaults to {@link LINELENGTH}
* @param int $lineEnd Defaults to {@link LINEEND}
* @return string
*/
public static function encodeQuotedPrintable($str,
$lineLength = self::LINELENGTH,
$lineEnd = self::LINEEND){
$out = '';
print __LINE__ .":$str\n";

129:Insider-Geheimnis für die Verdoppelung oder Verdreifachung Ihres Umsatzes!


$str = str_replace('=', '=3D', $str);
print __LINE__ .":$str\n";

131:Insider-Geheimnis für die Verdoppelung oder Verdreifachung Ihres Umsatzes!


$str = str_replace(self::$qpKeys, self::$qpReplaceValues, $str);
print __LINE__ .":$str\n";

133:Insider-Geheimnis f=FCr die Verdoppelung oder Verdreifachung Ihres Umsatzes!


$str = rtrim($str);
print __LINE__ .":$str\n";

135:Insider-Geheimnis f=FCr die Verdoppelung oder Verdreifachung Ihres Umsatzes!



// Split encoded text into separate lines
while ($str) {
    $ptr = strlen($str);
    if ($ptr > $lineLength) {
    $ptr = $lineLength;
    }

    // Ensure we are not splitting across an encoded character
    $pos = strrpos(substr($str, 0, $ptr), '=');
    if ($pos !== false && $pos >= $ptr - 2) {
    $ptr = $pos;
    }

    // Check if there is a space at the end of the line and rewind
    if ($ptr > 0 && $str[$ptr - 1] == ' ') {
    --$ptr;
    }

    // Add string and continue
    $out .= substr($str, 0, $ptr) . '=' . $lineEnd;
    $str = substr($str, $ptr);
}

$out = rtrim($out, $lineEnd);
$out = rtrim($out, '=');
print __LINE__ .":$out\n";

162:Insider-Geheimnis f=FCr die Verdoppelung oder Verdreifachung Ihres Umsatze=
s!


return $out;
}




-------------
best regards

Atif


Posted By: LogSat
Date Posted: 18 February 2009 at 12:23am
Atif,

The problem is indeed with the folding. in an SMTP header, the lines below:

Subject: Insider-Geheimnis f=FCr die Verdoppelung oder Verdreifachung Ihres Umsatze=
s!


would actually be interpreted as a line indicating the header with the subject:
Subject: Insider-Geheimnis f=FCr die Verdoppelung oder Verdreifachung Ihres Umsatze=

and another line containing a separate (invalid) header:
s!

The "folding" in SMTP headers is obtained by ending a line with an CRLF and starting the following line with one or more spaces before the folded text. For example, the line above can be folded as:
Subject: Insider-Geheimnis f=FCr die Verdoppelung oder Verdreifachung Ihres
   Umsatzes!


or

Subject: Insider-Geheimnis f=FCr die
    Verdoppelung oder Verdreifachung Ihres Umsatzes!



etc.. (the complete RFC for headers - I oversimplified it a bit - is rfc822).

Thus if you have a MIME-encoded subject, and end the line with a "=" to fold, that is  not correct (the folding sequence is a CRLF + whitespace), and thus the "=" is interpreted as part of the MIME-encoded text, which "messes up" the encoding. So your encoded line should not look like (2 lines):

Subject: =?ISO-8859-1?Q?Insider-Geheimnis=20f=FCr=20die=20Verdoppelung=20oder=20Verdreifachung=20Ihres=20Umsatze=
s!?=

but rather something like (2 lines):

Subject: =?ISO-8859-1?Q?Insider-Geheimnis=20f=FCr=20die=20
  Verdoppelung=20oder=20Verdreifachung=20Ihres=20Umsatzes!?=

also as a side-note, you don't really need to worry about the spaces for the quote-printable stuff, you could simply have something like:

Subject: =?ISO-8859-1?Q?Insider-Geheimnis f=C3=BCr die Verdoppelung oder
   Verdreifachung Ihres Umsatzes!?=



-------------
Roberto Franceschetti

http://www.logsat.com" rel="nofollow - LogSat Software

http://www.logsat.com/sfi-spam-filter.asp" rel="nofollow - Spam Filter ISP


Posted By: atifghaffar
Date Posted: 05 March 2009 at 12:51pm
Roberto,
I have upgraded ZendFramework to version 1.7.6 and this problem now seems to be fixed.
Thanks a lot for debugging this with us.

best regards



-------------
best regards

Atif


Posted By: atifghaffar
Date Posted: 05 March 2009 at 12:51pm
The header now looks like this

Subject: =?iso-8859-1?Q?Insider-Geheimnis=20f=FCr=20die=20Verdoppelung=20?= =?iso-8859-1?Q?oder=20Verdreifachung=20Ihres=20Umsatzes!?=



-------------
best regards

Atif



Print Page | Close Window