My landlord recently changed to a different ISP that blocks all outgoing requests on port 25, except towards their own SMTP-server. After getting my hands dirty by plowing throgh the sendmail documentation, located here, I figured out that it wasn’t very difficult to configure sendmail to relay all outgoing e-mails towards this server, thus solving the entire problem.
If you want all outgoing mail to go to a central relay site, define SMART_HOST.
I started by checking the sendmail configuration file, /etc/mail/sendmail.cf, that strictly specified “DO NOT EDIT THIS FILE! Only edit the source .mc file.“. Following this advice, I had to figure out where this .mc file was located.
I did a quick search for all files containing sendmail and cf on my local system, and discovered “/usr/share/sendmail/cf/cf/sendmail-slackware.mc“. That was indeed the correct file, and I simply added “define(`SMART_HOST’, `smtp.online.no’)“. To see the entire configuration file, expand the spoiler below.
| Spoiler Inside: modified sendmail-slackware.mc |
SelectShow> |
dnl# This is the default sendmail .mc file for Slackware. To generate
dnl# the sendmail.cf file from this (perhaps after making some changes),
dnl# use the m4 files in /usr/share/sendmail/cf like this:
dnl#
dnl# cp sendmail-slackware.mc /usr/share/sendmail/cf/config.mc
dnl# cd /usr/share/sendmail/cf
dnl# sh Build config.cf
dnl#
dnl# You may then install the resulting .cf file:
dnl# cp config.cf /etc/mail/sendmail.cf
dnl#
include(`../m4/cf.m4')
VERSIONID(`modified Slackware Linux setup by VHA')dnl
OSTYPE(`linux')dnl
dnl# These settings help protect against people verifying email addresses
dnl# at your site in order to send you email that you probably don't want:
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
dnl# No timeout for ident:
define(`confTO_IDENT', `0')dnl
dnl# Enable smtp.online.no as smarthost
define(`SMART_HOST', `smtp.online.no')dnl
dnl# Enable the line below to use smrsh to restrict what sendmail can run:
dnl FEATURE(`smrsh',`/usr/sbin/smrsh')dnl
dnl# See the README in /usr/share/sendmail/cf for a ton of information on
dnl# how these options work:
FEATURE(`use_cw_file')dnl
FEATURE(`use_ct_file')dnl
FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl
FEATURE(`access_db', `hash -T /etc/mail/access')dnl
FEATURE(`blacklist_recipients')dnl
FEATURE(`local_procmail',`',`procmail -t -Y -a $h -d $u')dnl
FEATURE(`always_add_domain')dnl
FEATURE(`redirect')dnl
dnl# Turn this feature on if you don't always have DNS, or enjoy junk mail:
FEATURE(`accept_unresolvable_domains')dnl
EXPOSED_USER(`root')dnl
dnl# Also accept mail for localhost.localdomain:
LOCAL_DOMAIN(`localhost.localdomain')dnl
MAILER(local)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
|
Once that was done, I had to compile the configuration file with “m4 /usr/share/sendmail/cf/cf/my-sendmail.slackware.mc > /etc/mail/sendmail.cf“, and restart inetd and sendmail by running /etc/rc.d/rc.inetd restart && /etc/rc.d/rc.sendmail restart.
Problem solved, and I’m receiving my emails again!
Takker
Fikk nettopp bruk for dette, og synes jeg kunne huske at du hadde skrevet noe om det! Når man kjører m4-kommandoen, må man også passe på å stå i “/usr/share/sendmail/cf/cf/”, da .mc-fila inkluderer en annen fil ved hjelp av relativ filbane
Flott at andre enn meg får bruk for det