You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Ted Mittelstaedt <te...@ipinc.net> on 2026/04/16 07:42:39 UTC

Setup instructions for Spamassassin on Ubuntu Server 24.04.4 LTS using Sendmail

The following are the steps I used for this.   Every guide I came across 
to do it was wrong and useless, however this one:

https://oneuptime.com/blog/post/2026-01-15-configure-spamassassin-ubuntu/view

skipping over the beginning (which was all wrong) the info after the 
section "Custom Rules" is not that terrible.

Note the Linux community almost always reaches for postfix because that 
is what they know, very few of them use sendmail and often when you see 
sendmail mentioned it's actually the postfix sendmail stub program not 
the real sendmail.

With that out of the way:

1) Install Ubuntu Server and configure to ssh into it, static IP, add 
name to /etc/hosts, ntp time sync it, set correct timezone, hostname, 
forward and reverse dns records, setup backups, update, etc.

2)  apt-get install sendmail

this installs version 8.18.1 of sendmail.

(8.18.2 is the latest version of sendmail)

3) run the script

sendmailconfig

4) test local delivery

# /usr/sbin/sendmail tedm
From: tedm@localhost
Subject: test

test
.

cat /var/mail/tedm
make sure mail is there

5) Add the IP address on your machines interface you want your machine 
to receive mail on

cd /etc/mail
add
DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp, Addr=86.75.30.9')dnl

to sendmail.mc

make
  /etc/init.d/sendmail reload

6) Test from another host make sure your getting mail

7) apt install spamassassin
  systemctl enable spamd

cd /etc/spamassassin
  cp  local.cf  local.cf.installed
  vi local.cf

make your configuration changes and save

  systemctl start spamd

8)  cd /etc/mail
mkdir -p /etc/mail/spamassassin

vi /etc/mail/spamassassin/spamassassin.m4

Put in:

dnl
dnl Process mail through spamassassin
dnl
define(`confMILTER_MACROS_ENVFROM', `i, {auth_type}, {auth_authen}, 
{auth_ssf}, {auth_author}, {mail_mailer}, {mail_host}, {mail_addr}, r, 
b, v, Z')dnl
define(`confMILTER_MACROS_ENVRCPT', `{auth_type}, r, v, Z')dnl
INPUT_MAIL_FILTER(`spamassassin', 
`S=local:/var/run/spamass/spamass.sock, F=, T=C:15m;S:4m;R:4m;E:10m')dnl

9)  add this template to the main sendmail.mc
cd /etc/mail
  cp sendmail.mc sendmail.mc.nospamassassin

  vi sendmail.mc

add:

include(`/etc/mail/spamassassin/spamassassin.m4')dnl

right before MAILER_DEFINITIONS  and save

10)  install spamass-milter

service spamd stop

apt-get install spamass-milter

cd /etc/default

vi spamass-milter

uncomment and modify:
SOCKETOWNER="spamass-milter:spamass-milter"

save

systemctl enable spamass-milter

service spamd start

  systemctl start spamass-milter

As of this writing all of the Ubuntu packages install correct 
config/default files for systemctl and so on

The spamassassin package is version 4.0.2 for this version of Ubuntu:

https://packages.ubuntu.com/noble/spamassassin

The spamass-milter is version 0.4.0

https://packages.ubuntu.com/noble/spamass-milter

Note that the Ubuntu packager modified all of the prefixes.

So just downloading it and compiling the latest version will put it in 
/usr/local/sbin instead of /usr/sbin and so on for all the other locations.

Ted


Re: Setup instructions for Spamassassin on Ubuntu Server 24.04.4 LTS using Sendmail

Posted by Ted Mittelstaedt <te...@ipinc.net>.
Absolutely!!!  Please add it!

Also note that my documented approach is to use the prebuilt packages 
exclusively.

Another approach would be to NOT do an apt-get install on spamassassin, 
but do it on everything else, then manually download the latest SA 
package and build it.  But you would need to adjust all of the SA file 
locations in the config files for sendmail and spamass-milter, you would 
lose the autostarts, and you would lose support for Ubuntu from Canonical.

Ted

On 4/16/2026 5:38 AM, Bill Cole wrote:
> On 2026-04-16 at 03:42:39 UTC-0400 (Thu, 16 Apr 2026 00:42:39 -0700)
> Ted Mittelstaedt <us...@spamassassin.apache.org>
> is rumored to have said:
>
>> The following are the steps I used for this.   Every guide I came 
>> across to do it was wrong and useless,
>
> THANKS TED!
>
> One of my pet peeves is all of those wrong and useless "guides" for SA 
> and other open source tools. It has only been amplified by the scourge 
> of AI, both replacing real search with synthesis and using all the 
> garbage to synthesize remarkably well-polished turds.
>
> Does the ASF have your permission to add your guide to the SA wiki 
> with credit?
>
>
>> https://oneuptime.com/blog/post/2026-01-15-configure-spamassassin-ubuntu/view 
>>
>>
>> skipping over the beginning (which was all wrong) the info after the 
>> section "Custom Rules" is not that terrible.
>>
>> Note the Linux community almost always reaches for postfix because 
>> that is what they know, very few of them use sendmail and often when 
>> you see sendmail mentioned it's actually the postfix sendmail stub 
>> program not the real sendmail.
>>
>> With that out of the way:
>>
>> 1) Install Ubuntu Server and configure to ssh into it, static IP, add 
>> name to /etc/hosts, ntp time sync it, set correct timezone, hostname, 
>> forward and reverse dns records, setup backups, update, etc.
>>
>> 2)  apt-get install sendmail
>>
>> this installs version 8.18.1 of sendmail.
>>
>> (8.18.2 is the latest version of sendmail)
>>
>> 3) run the script
>>
>> sendmailconfig
>>
>> 4) test local delivery
>>
>> # /usr/sbin/sendmail tedm
>> From: tedm@localhost
>> Subject: test
>>
>> test
>> .
>>
>> cat /var/mail/tedm
>> make sure mail is there
>>
>> 5) Add the IP address on your machines interface you want your 
>> machine to receive mail on
>>
>> cd /etc/mail
>> add
>> DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp, 
>> Addr=86.75.30.9')dnl
>>
>> to sendmail.mc
>>
>> make
>>  /etc/init.d/sendmail reload
>>
>> 6) Test from another host make sure your getting mail
>>
>> 7) apt install spamassassin
>>  systemctl enable spamd
>>
>> cd /etc/spamassassin
>>  cp  local.cf  local.cf.installed
>>  vi local.cf
>>
>> make your configuration changes and save
>>
>>  systemctl start spamd
>>
>> 8)  cd /etc/mail
>> mkdir -p /etc/mail/spamassassin
>>
>> vi /etc/mail/spamassassin/spamassassin.m4
>>
>> Put in:
>>
>> dnl
>> dnl Process mail through spamassassin
>> dnl
>> define(`confMILTER_MACROS_ENVFROM', `i, {auth_type}, {auth_authen}, 
>> {auth_ssf}, {auth_author}, {mail_mailer}, {mail_host}, {mail_addr}, 
>> r, b, v, Z')dnl
>> define(`confMILTER_MACROS_ENVRCPT', `{auth_type}, r, v, Z')dnl
>> INPUT_MAIL_FILTER(`spamassassin', 
>> `S=local:/var/run/spamass/spamass.sock, F=, T=C:15m;S:4m;R:4m;E:10m')dnl
>>
>> 9)  add this template to the main sendmail.mc
>> cd /etc/mail
>>  cp sendmail.mc sendmail.mc.nospamassassin
>>
>>  vi sendmail.mc
>>
>> add:
>>
>> include(`/etc/mail/spamassassin/spamassassin.m4')dnl
>>
>> right before MAILER_DEFINITIONS  and save
>>
>> 10)  install spamass-milter
>>
>> service spamd stop
>>
>> apt-get install spamass-milter
>>
>> cd /etc/default
>>
>> vi spamass-milter
>>
>> uncomment and modify:
>> SOCKETOWNER="spamass-milter:spamass-milter"
>>
>> save
>>
>> systemctl enable spamass-milter
>>
>> service spamd start
>>
>>  systemctl start spamass-milter
>>
>> As of this writing all of the Ubuntu packages install correct 
>> config/default files for systemctl and so on
>>
>> The spamassassin package is version 4.0.2 for this version of Ubuntu:
>>
>> https://packages.ubuntu.com/noble/spamassassin
>>
>> The spamass-milter is version 0.4.0
>>
>> https://packages.ubuntu.com/noble/spamass-milter
>>
>> Note that the Ubuntu packager modified all of the prefixes.
>>
>> So just downloading it and compiling the latest version will put it 
>> in /usr/local/sbin instead of /usr/sbin and so on for all the other 
>> locations.
>>
>> Ted
>
>

Re: Setup instructions for Spamassassin on Ubuntu Server 24.04.4 LTS using Sendmail

Posted by Bill Cole <bi...@apache.org>.
On 2026-04-16 at 03:42:39 UTC-0400 (Thu, 16 Apr 2026 00:42:39 -0700)
Ted Mittelstaedt <us...@spamassassin.apache.org>
is rumored to have said:

> The following are the steps I used for this.   Every guide I came 
> across to do it was wrong and useless,

THANKS TED!

One of my pet peeves is all of those wrong and useless "guides" for SA 
and other open source tools. It has only been amplified by the scourge 
of AI, both replacing real search with synthesis and using all the 
garbage to synthesize remarkably well-polished turds.

Does the ASF have your permission to add your guide to the SA wiki with 
credit?


> https://oneuptime.com/blog/post/2026-01-15-configure-spamassassin-ubuntu/view
>
> skipping over the beginning (which was all wrong) the info after the 
> section "Custom Rules" is not that terrible.
>
> Note the Linux community almost always reaches for postfix because 
> that is what they know, very few of them use sendmail and often when 
> you see sendmail mentioned it's actually the postfix sendmail stub 
> program not the real sendmail.
>
> With that out of the way:
>
> 1) Install Ubuntu Server and configure to ssh into it, static IP, add 
> name to /etc/hosts, ntp time sync it, set correct timezone, hostname, 
> forward and reverse dns records, setup backups, update, etc.
>
> 2)  apt-get install sendmail
>
> this installs version 8.18.1 of sendmail.
>
> (8.18.2 is the latest version of sendmail)
>
> 3) run the script
>
> sendmailconfig
>
> 4) test local delivery
>
> # /usr/sbin/sendmail tedm
> From: tedm@localhost
> Subject: test
>
> test
> .
>
> cat /var/mail/tedm
> make sure mail is there
>
> 5) Add the IP address on your machines interface you want your machine 
> to receive mail on
>
> cd /etc/mail
> add
> DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp, 
> Addr=86.75.30.9')dnl
>
> to sendmail.mc
>
> make
>  /etc/init.d/sendmail reload
>
> 6) Test from another host make sure your getting mail
>
> 7) apt install spamassassin
>  systemctl enable spamd
>
> cd /etc/spamassassin
>  cp  local.cf  local.cf.installed
>  vi local.cf
>
> make your configuration changes and save
>
>  systemctl start spamd
>
> 8)  cd /etc/mail
> mkdir -p /etc/mail/spamassassin
>
> vi /etc/mail/spamassassin/spamassassin.m4
>
> Put in:
>
> dnl
> dnl Process mail through spamassassin
> dnl
> define(`confMILTER_MACROS_ENVFROM', `i, {auth_type}, {auth_authen}, 
> {auth_ssf}, {auth_author}, {mail_mailer}, {mail_host}, {mail_addr}, r, 
> b, v, Z')dnl
> define(`confMILTER_MACROS_ENVRCPT', `{auth_type}, r, v, Z')dnl
> INPUT_MAIL_FILTER(`spamassassin', 
> `S=local:/var/run/spamass/spamass.sock, F=, 
> T=C:15m;S:4m;R:4m;E:10m')dnl
>
> 9)  add this template to the main sendmail.mc
> cd /etc/mail
>  cp sendmail.mc sendmail.mc.nospamassassin
>
>  vi sendmail.mc
>
> add:
>
> include(`/etc/mail/spamassassin/spamassassin.m4')dnl
>
> right before MAILER_DEFINITIONS  and save
>
> 10)  install spamass-milter
>
> service spamd stop
>
> apt-get install spamass-milter
>
> cd /etc/default
>
> vi spamass-milter
>
> uncomment and modify:
> SOCKETOWNER="spamass-milter:spamass-milter"
>
> save
>
> systemctl enable spamass-milter
>
> service spamd start
>
>  systemctl start spamass-milter
>
> As of this writing all of the Ubuntu packages install correct 
> config/default files for systemctl and so on
>
> The spamassassin package is version 4.0.2 for this version of Ubuntu:
>
> https://packages.ubuntu.com/noble/spamassassin
>
> The spamass-milter is version 0.4.0
>
> https://packages.ubuntu.com/noble/spamass-milter
>
> Note that the Ubuntu packager modified all of the prefixes.
>
> So just downloading it and compiling the latest version will put it in 
> /usr/local/sbin instead of /usr/sbin and so on for all the other 
> locations.
>
> Ted


-- 
  Bill Cole
  bill@scconsult.com or billcole@apache.org
  (AKA @grumpybozo@toad.social and many *@billmail.scconsult.com 
addresses)
  Please keep discussion mailing list replies *on-list*
  Not Currently Available For Hire

Re: Setup instructions for Spamassassin on Ubuntu Server 24.04.4 LTS using Sendmail

Posted by Ted Mittelstaedt <te...@ipinc.net>.
Oops - forgot to say must run sendmailconfig  right after step 9

Ted

On 4/16/2026 12:42 AM, Ted Mittelstaedt wrote:
> The following are the steps I used for this.   Every guide I came 
> across to do it was wrong and useless, however this one:
>
> https://oneuptime.com/blog/post/2026-01-15-configure-spamassassin-ubuntu/view 
>
>
> skipping over the beginning (which was all wrong) the info after the 
> section "Custom Rules" is not that terrible.
>
> Note the Linux community almost always reaches for postfix because 
> that is what they know, very few of them use sendmail and often when 
> you see sendmail mentioned it's actually the postfix sendmail stub 
> program not the real sendmail.
>
> With that out of the way:
>
> 1) Install Ubuntu Server and configure to ssh into it, static IP, add 
> name to /etc/hosts, ntp time sync it, set correct timezone, hostname, 
> forward and reverse dns records, setup backups, update, etc.
>
> 2)  apt-get install sendmail
>
> this installs version 8.18.1 of sendmail.
>
> (8.18.2 is the latest version of sendmail)
>
> 3) run the script
>
> sendmailconfig
>
> 4) test local delivery
>
> # /usr/sbin/sendmail tedm
> From: tedm@localhost
> Subject: test
>
> test
> .
>
> cat /var/mail/tedm
> make sure mail is there
>
> 5) Add the IP address on your machines interface you want your machine 
> to receive mail on
>
> cd /etc/mail
> add
> DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp, 
> Addr=86.75.30.9')dnl
>
> to sendmail.mc
>
> make
>  /etc/init.d/sendmail reload
>
> 6) Test from another host make sure your getting mail
>
> 7) apt install spamassassin
>  systemctl enable spamd
>
> cd /etc/spamassassin
>  cp  local.cf  local.cf.installed
>  vi local.cf
>
> make your configuration changes and save
>
>  systemctl start spamd
>
> 8)  cd /etc/mail
> mkdir -p /etc/mail/spamassassin
>
> vi /etc/mail/spamassassin/spamassassin.m4
>
> Put in:
>
> dnl
> dnl Process mail through spamassassin
> dnl
> define(`confMILTER_MACROS_ENVFROM', `i, {auth_type}, {auth_authen}, 
> {auth_ssf}, {auth_author}, {mail_mailer}, {mail_host}, {mail_addr}, r, 
> b, v, Z')dnl
> define(`confMILTER_MACROS_ENVRCPT', `{auth_type}, r, v, Z')dnl
> INPUT_MAIL_FILTER(`spamassassin', 
> `S=local:/var/run/spamass/spamass.sock, F=, T=C:15m;S:4m;R:4m;E:10m')dnl
>
> 9)  add this template to the main sendmail.mc
> cd /etc/mail
>  cp sendmail.mc sendmail.mc.nospamassassin
>
>  vi sendmail.mc
>
> add:
>
> include(`/etc/mail/spamassassin/spamassassin.m4')dnl
>
> right before MAILER_DEFINITIONS  and save
>
> 10)  install spamass-milter
>
> service spamd stop
>
> apt-get install spamass-milter
>
> cd /etc/default
>
> vi spamass-milter
>
> uncomment and modify:
> SOCKETOWNER="spamass-milter:spamass-milter"
>
> save
>
> systemctl enable spamass-milter
>
> service spamd start
>
>  systemctl start spamass-milter
>
> As of this writing all of the Ubuntu packages install correct 
> config/default files for systemctl and so on
>
> The spamassassin package is version 4.0.2 for this version of Ubuntu:
>
> https://packages.ubuntu.com/noble/spamassassin
>
> The spamass-milter is version 0.4.0
>
> https://packages.ubuntu.com/noble/spamass-milter
>
> Note that the Ubuntu packager modified all of the prefixes.
>
> So just downloading it and compiling the latest version will put it in 
> /usr/local/sbin instead of /usr/sbin and so on for all the other 
> locations.
>
> Ted