Fixing SpamAssassin Spam/Ham Reports on cPanel servers

July 5, 2012
A few months ago, cPanel released an "upgrape" that caused SpamAssassin Spam/Ham reports to include blank lines. This is a problem because folding continuation lines cannot contain only white space, so the header is invalid. The result is that the report or other headers may appear in the body of the email if you use an email client such as Outlook, or AVG's email scanner. Also, the subject may not appear. Since the two cPanel techs we dealt with, as well as a tech from our datacentre, did not know how to solve the problem, we post the workaround that we wrote here. If you have root access to your server, the following will correct the problem for all accounts. Add the following code to your /scripts/postupcp file, or create it with execute permissions if it doesn't exist. If you don't have root access on your server, ask your systems administrator to do this for you. After running upcp, the reports should be corrected.
# Fix spam/ham reports
if ! grep -q "clear_report_template" /etc/mail/spamassassin/local.cf
then
echo "
clear_report_template
report Spam detection software, running on the system _HOSTNAME_, has
report identified this incoming email as possible spam.  The original message
report has been attached to this so you can view it (if it isn't spam) or label
report similar future email.  If you have any questions, see
report _CONTACTADDRESS_ for details.
report Content preview:  _PREVIEW_
report Content analysis details:   (_SCORE_ points, _REQD_ required)
report   pts rule name              description
report  ---- ---------------------- -----------------------------------------
report _SUMMARY_
" >> /etc/mail/spamassassin/local.cf
/sbin/service exim restart
fi
If you do not have root access to your server, add the following to /home/USERNAME/.spamassassin/custom_report to correct the problem for your account only:
# Fix spam/ham reports
clear_report_template
report Spam detection software, running on the system _HOSTNAME_, has
report identified this incoming email as possible spam.  The original message
report has been attached to this so you can view it (if it isn't spam) or label
report similar future email.  If you have any questions, see
report _CONTACTADDRESS_ for details.
report Content preview:  _PREVIEW_
report Content analysis details:   (_SCORE_ points, _REQD_ required)
report   pts rule name              description
report  ---- ---------------------- -----------------------------------------
report _SUMMARY_
Then, add the following to /home/USERNAME/.spamassassin/user_prefs:
include custom_report
Name: Email: (Required only if you want a reply.) Comment:
DoG
October 4, 2016
I'm in heaven. Finally i am getting email to SMS in one message!