1

I have installed (clean) Debian 6 on VPS, and I am running a Django-powered application on it. Everything works fine, except that I need to set up SMTP to enable my application (meaning sender is local) to send out emails to its users (so, the recipients are elsewhere on Internet).

What would be the eaisest way to do that? Debian usually comes with exim4, but I have problems setting it up to perform this basic task. Is there any kind of tutorial, or a set of basic steps I need to check?

I don't need any local email delivery right now.

When I try to send email using the default config, here's what I get in /var/log/exim/mainlog (replaced the two domains with foo.com and bar.com):

2011-08-27 18:05:27 1QxLNv-0008EL-60 <= jablan@foo.com H=localhost (foo.com) [127.0.0.1] P=esmtp S=2438
2011-08-27 18:05:27 1QxLNv-0008EL-60 remote host address is the local host: bar.com
2011-08-27 18:05:27 1QxLNv-0008EL-60 == jablan@bar.com R=smarthost defer (-1): remote host address is the local host
2011-08-27 18:05:27 1QxLNv-0008EN-7y <= <> R=1QxLNv-0008EL-60 U=Debian-exim P=local S=567
2011-08-27 18:05:27 1QxLNv-0008EL-60 Frozen
2011-08-27 18:05:27 1QxLNv-0008EN-7y remote host address is the local host: foo.com
2011-08-27 18:05:27 1QxLNv-0008EN-7y == jablan@foo.com <postmaster@foo.com> R=hub_user_smarthost defer (-1): remote host address is the local host
2011-08-27 18:05:27 1QxLNv-0008EN-7y Frozen
  • Once the package is installed it is pretty much good to go, please explain what problems you are seeing. – Steve-o Aug 27 '11 at 16:02
  • I have added some log samples to the question. – Mladen Jablanović Aug 27 '11 at 16:11
  • Did you tell Exim that the smarthost was it's own IP address? – EightBitTony Aug 27 '11 at 16:53
  • Actually, can you just post the content of /etc/exim4/update-exim4.conf.conf - it's much easier if you don't obscure stuff, but if you do, can you make it obvious. – EightBitTony Aug 27 '11 at 17:31
  • This is almost always a bad idea. If you want your e-mail to actually reach all of your recipients and not get flagged as spam, you usually want to pay for a access to a service and use their smtp server. – Joel Coel Aug 28 '11 at 02:29

2 Answers2

3

Your exim4 is wrongly configured.

You need to find out what's the best way to send out email from your VPS provider. It could either be via their SMTP server, which means you need to configure it for a smarthost or it could be delivered directly by your VPS, which means that you need to configure it as a full internet site.

Either way, reconfigure your exim4 by issuing a:

# sudo dpkg-reconfigure exim4-config

There you can select:

internet site; mail is sent and received directly using SMTP
mail sent by smarthost; received via SMTP or fetchmail
mail sent by smarthost; no local mail
local delivery only; not on a network
no configuration at this time                                                                                             

Reconfigure it accordingly.

sybreon
  • 7,405
  • 1
  • 21
  • 20
  • I managed to get it going. First, I reconfigured exim for "internet site", and also I actually assigned my server a real domain, the same one which the sender email address uses. This also seemed to be a problem - SMTP servers checking whether the sender domain matches the domain of the machine. Anyway, thanks all, everything seems to be working now! – Mladen Jablanović Aug 28 '11 at 06:54
1

"Remote host address is the local host" means you've done one of two things:

  • Told Exim that it's smarthost is, in fact, itself (which annoys it no end); or
  • DNS says that the MX/A record for the destination domain is, in fact, the same machine, and you haven't configured the MTA to receive mail for the domain.

Given that Exim is frothing about smarthosts, I'd say you've got the former.

If you configure your Exim installation with the correct smarthost (typically that of your ISP or MSP) it'll definitely... well, not necessarily work, but at least give you a different error.

womble
  • 96,255
  • 29
  • 175
  • 230