Mail corrupted by the word From

dolphyn

Well-Known Member
Nov 27, 2001
64
0
306
cPanel Access Level
Root Administrator
Okay folks, tell me if I'm nuts. :)

If I send plaintext email to my server where [i:080ad0d62e]any line[/i:080ad0d62e] in the body of the message [i:080ad0d62e]begins[/i:080ad0d62e] with the word [b:080ad0d62e]From[/b:080ad0d62e] [i:080ad0d62e]followed by a space[/i:080ad0d62e], the message gets corrupted.

If SpamAssassin is enabled, the message is truncated or split into separate messages. Without SpamAssassin, an extra character is inserted, i.e. [b:080ad0d62e]&From[/b:080ad0d62e] .

Does anyone have a solution for this? I submitted a bug some time ago, but I only knew half the problem when I submitted it.
http://web.cpanel.net/bugzilla/show_bug.cgi?id=882
 

Juanra

Well-Known Member
Sep 22, 2001
777
0
316
Spain
A line starting with &From[space]& and following a blank line acts as a message delimiter. So if the line starting with &From & belongs to the message body, Exim prepends a & sign to it.

See here:
http://groups.google.com/groups?th=7a94826c98e1453
http://email.about.com/library/weekly/aa111300a.htm

SA folks believe it's not their fault if the messages get splitted:
http://bugzilla.spamassassin.org/show_bug.cgi?id=730
 

chriseng

Registered
Nov 7, 2002
2
0
151
a solution for this problem

i have a workaround for this problem. i figured out how to configure it to use procmail as the mail delivery agent, which automatically prepends the &From& lines in the message body with a &&& to prevent these mail splitting problems.

here's what you do:


1. create the file /etc/vfilters/yourdomain.com with the following contents:

----- start file contents
# Exim filter

if error_message then finish endif

if
$local_part is &accountname&
then
pipe &/usr/bin/procmail -a ${extract{5}{:}{${lookup{${lookup{$domain}lsearch*{
/etc/userdomains}{$value}}}lsearch{/etc/passwd}{$value}}}}/mail/${domain}/${loca
l_part}/inbox&
endif
----- end file contents

replace &accountname& with your actual e-mail account name. so if your e-mail address is &[email protected]&, you'd use &foo&, and the file would be called /etc/vfilters/bar.com.

if you have multiple e-mail accounts in the domain (most people probably do), you can do something to the effect of:

if
$local_part is &accountname& or
$local_part is &accountname2& or
$local_part is &accountname3&
then
...

2. create the file .procmailrc in your home directory with the following contents:

----- start file contents
PMDIR=$HOME/.procmail
LOGFILE=$PMDIR/log
DEFAULT=$1 # the exim filter passes this in

:0 fw
| /usr/bin/spamassassin
----- end file contents


that's it! now, when mail arrives, exim will pipe it through procmail for delivery instead of piping it to spamassassin (which isn't supposed to handle delivery). procmail will then filter it through spamassassin, and deliver it to the local mailbox.

a couple caveats to this approach:

1. if you use the cpanel gui to block e-mails or anything else that uses the /etc/vfilters/yourdomain.com file, i don't know what will happen. i don't use the gui, i prefer to edit the file manually so i know exactly what's in there. if you're doing this, you probably are of the same mentality anyway.

2. you must account for every e-mail address individually. if you set up your /etc/vfilters/yourdomain.com file to pipe everything through procmail, you would get delivery errors when you try to send mail to an e-mail address that is aliased, or anything destined for the catch-all mailbox. this is because the pipe to procmail would be happening before exim had a chance to substitute the real address for the aliased address.

3. there may be more caveats, but this is all i've personally run into. i'm not a cpanel developer, i'm just a guy who's having the same problem and wanted a workaround for it rather than waiting around indefinitely for it to be officially fixed. your mileage may vary.

-chris
 

chriseng

Registered
Nov 7, 2002
2
0
151
[quote:6ff94cecac][i:6ff94cecac]Originally posted by chriseng[/i:6ff94cecac]

pipe &/usr/bin/procmail -a ${extract{5}{:}{${lookup{${lookup{$domain}lsearch*{
/etc/userdomains}{$value}}}lsearch{/etc/passwd}{$value}}}}/mail/${domain}/${loca
l_part}/inbox&[/quote:6ff94cecac]note: this is all supposed to be one line, but it's not displaying correctly here.