I spend some time today trying to figure out how I would be able to
send mail to SourceForge. SourceForge is an enormous enterprise
with more than a million users and hundred thousand projects, most of
which have one or more mailinglists associated with them — the
amount of mail flowing through SourceForge each day must be huge. So
why should I have difficulties sending mail to an address at
SourceForge, you might ask? I’ll tell you… :-)
First I discovered that mail bound for mailinglists at SourceForge
would disappear on its way. The mail first goes to my local Exim
which forwards it to mail.bluewin.ch
— the SMTP server at my
ISP Bluewin. After that I have no idea what has happened to my
mail, I only know that it doesn’t reach the SF mailinglists. A mail
to postmaster@bluewin.ch six days ago has gone unanswered… :-/
I then tried cutting out the middle-man and configured my Exim (using
the super-simple Debian way of dpkg-reconfigure exim4-config
) to
send its mail directly like a full-blown SMTP server. I had initially
not configured Exim like that because I didn’t want to add yet another
publicly accessible server to my system.
But then I ran into the next problem: the spam filtering done at
SourceForge. Every time someone tries to send something to their Exim
SMTP server (cool, SourceForge use Exim too!) it will make a callout
verification of the sender address. This simply means that it
will try to deliver a message to the envelope address in the mail. In
my case that failed for some reason, and I got this in my Exim log
file:
451-could not connect to xxx [xxx.xxx.xxx.xxx]: Connection refused
451-Could not complete sender verify callout for <mg@xxx>.
451-The mail server(s) for the domain may be temporarily unreachable, or
451-they may be permanently unreachable from this server. In the latter case,
451-you need to change the address or create an MX record for its domain
451-if it is supposed to be generally accessible from the Internet.
451 Talk to your mail administrator for details.
I tried opening my router to allow the incoming connection to port 25
(SMTP) but it didn’t help. What to do? The usual when you run into a
problem like this: read lots of man pages, configuration files,
documentation, websites, etc… :-)
And surely enough, it worked: While reading through the Exim
configuration files under /etc/exim4/conf.d/
I stumbled over a
reference to /etc/email-addresses
. That file is used by Exim when
it inserts the envelope sender header in its outgoing mail: if a user
is not listed in that file (the default) then it generates the
envelope address of
Return-Path: <username@hostname>
In my case that made SourceForge do the callout back to my machine.
If I instead add the line
mg: [email protected]
to /etc/email-addresses
I get the following, much better envelope
address in my outgoing mail:
Return-Path: <[email protected]>
which causes SourceForge to check with mail.mgeisler.net (the mail
exchange for mgeisler.net). And this check succeeds! Hurray, I can
now once again send mail to SourceForge hosted mailinglists!
By the way, if you’re running an SMTP server and you’re having
problems with spam, then try the Spam Filtering for Mail
Exchangers guide to rejecting junk mail in incoming SMTP
transactions. They describe a whole bunch of tricks, including the
callout verification technique described above and the very
clever greylisting technique.
The advantage of this is that you’ll save yourself the trouble of
filtering the spam later using something like SpamAssassin, and
you’ll save yourself the bandwidth cost of receiving the spam in the
first case since you can drop the connection before it has even
entered your system.