Round bracket on new line and broken email

Bugs in eFa 4
Post Reply
maio
Posts: 3
Joined: 14 Oct 2021 20:45

Round bracket on new line and broken email

Post by maio »

Hi,
I'd need some help to fix a very strange issue that happens on one of my 3 EFA servers (v. 4.0.3) that occurs from just one specific domain/sender.

Some of the emails received from this sender seem to have an "extra" line-break in the "receive" header and when the mail arrives on the client (or webmail) it's basically broken, ie: the header portion appears in the body.

Honestly I don't even know if the problem is on EFA or on the sender's server; the sender's domain/servers are managed by a rather big italian ISP.

This is how the headers look in mailwatch:
2021-10-14 22_54_57-Clipboard.png
2021-10-14 22_54_57-Clipboard.png (10.34 KiB) Viewed 5941 times
As you can see there's a closed round bracket on the sceond line.

This is how the email looks on the client (the same occurs on different email client and webmail as well):
2021-10-14 22_58_22-Clipboard.png
2021-10-14 22_58_22-Clipboard.png (17.56 KiB) Viewed 5941 times
The "Apache" sender has nothing to do with the actual sender of the email; and the body of the email starts from the infamous round bracket.

If i manually edit the file in the quarantine folder on EFA, so that the round bracket on line 2 is moved on the end of line 1, and re-send the email, then is sent and shown correctly on the client.

Did anyone had to face a similar issue or have some advice to share to help me?

Thanks to all
Maio
User avatar
shawniverson
Posts: 3640
Joined: 13 Jan 2014 23:30
Location: Indianapolis, Indiana USA
Contact:

Re: Round bracket on new line and broken email

Post by shawniverson »

That sure does look strange.

So, that would be happening here, and I think maybe it is a 3rd call to this sub since you seem to have ended up with two Received: on the same line. It seems you are getting different hostnames passed with each call, oddly enough.

/usr/sbin/MSMilter:154

Code: Select all

sub helo_callback
{
    my $ctx = shift;
    my $helohost = shift;
    my $message_ref = $ctx->getpriv();
    my $message = "Received: from $helohost";
    # Watch for the second callback
    if ( $message ne substr(${$message_ref}, 0, length($message)) ) {
        ${$message_ref} = $message . ' (' . ${$message_ref} . ')' ."\n";
        MailScanner::Log::DebugLog("helo_callback: $message");
    }

    $ctx->setpriv($message_ref);

    Sendmail::PMilter::SMFIS_CONTINUE;
}
I'm wondering if this would fix it by generalizing the callback to look just for "Received:" instead of both it and the hostname.

Code: Select all

sub helo_callback
{
    my $ctx = shift;
    my $helohost = shift;
    my $message_ref = $ctx->getpriv();
    my $message = "Received: from $helohost";
    # Watch for the second callback
    if ( ${$message_ref} !~ /^Received:/ ) {
        ${$message_ref} = $message . ' (' . ${$message_ref} . ')' ."\n";
        MailScanner::Log::DebugLog("helo_callback: $message");
    }

    $ctx->setpriv($message_ref);

    Sendmail::PMilter::SMFIS_CONTINUE;
}
maio
Posts: 3
Joined: 14 Oct 2021 20:45

Re: Round bracket on new line and broken email

Post by maio »

Hi,
thanks for the answer; I've changed the code as you suggested, but I don't know if it's valid only for new emails; I've just tried to re-send one of the old emails from quarantine but they're still "broken".
Anyway tomorrow I'm going to ask to the "sender" to send another couple of email to check if it works.

Thanks again
Maio
maio
Posts: 3
Joined: 14 Oct 2021 20:45

Re: Round bracket on new line and broken email

Post by maio »

Hi,
I'v got a positive feedback from the customer, so the issue is fixed.

Will this fix be introduced on next releases or preserved in future upgrades?

Once again thanks for your support.
Maio
Post Reply