0

We have the following setup:

  • One web-server on Debian with PHP on the main domain, that can send emails, but must not receive. It has exim4 installed. Let's call it example.com
  • One mail server on a different machine, that is used for both sending and receiving emails. This one would be mail.example.com.

I am only in charge of the first server, which was migrated. The second one is shared with other domains working fine. The problem is I can't make it send emails to the second one. When a user from a different domain uses the password reset option on our site, the new password is sent successfully to them, but when a user@example.com tries it, then the first server tries to deliver the mail locally. I tried setting it to relay to mail.example.com, but then it tries to send every single email through it, whether they belong there or not. I've exhausted the options given when I try dpkg-reconfigure exim4-config that I could think of. Most of them I don't understand, because half the time these unix people name things the exact opposite of what they mean.

coladict
  • 219
  • 1
  • 7
  • 2
    In your case, `example.com` is no longer a valid [FQDN](http://serverfault.com/q/609188/217116), use e.g. `web.example.com`. Please give us more information on your configuration *I tried sth.* is not a helpful info. – sebix Apr 06 '15 at 15:44
  • With dpkg-reconfigure I set it to internet mail to send and receive via SMTP for that domain and website. There isn't any other configuration info to give, that I have used, except the real names. – coladict Apr 06 '15 at 16:09

2 Answers2

1

Sending mail via a smarthost is a standard exim4 configuration. This meets the criteria you specify above.

Run dpkg-reconfigure exim4-config. Select the option mail sent by smarthost; no local mail. Then configure the second host as the smarthost.

BillThor
  • 27,354
  • 3
  • 35
  • 69
  • I have no access to the second host. I don't even know who does, but that server is shared for many domains. – coladict Apr 06 '15 at 16:11
  • 1
    @coladict You need to configure your host, not the second host. It should then forward you mail appropriately. Your domain will need an appropriate MX record to point to its mail server. – BillThor Apr 06 '15 at 16:15
  • That doesn't actually tell me anything. When I tried searching what smarthost is I got tons of websites bragging about their software, but no definition to explain it to me. – coladict Apr 07 '15 at 06:10
  • @coladict Smarthost is a central server that knows how to route mail. Just a term for a role not software. ISPs relays are the most commonly used smarthosts. – BillThor Apr 07 '15 at 11:31
  • so you're saying I do need some control to the other server? Then there is no way to make it behave the way I need. – coladict Apr 07 '15 at 18:17
  • @coladic You don't need any control of the second server. You only need to configure your server to route all mail to the second server. – BillThor Apr 08 '15 at 00:11
  • except that it rejects it all, because it probably requires authentication to send those emails. – coladict Apr 08 '15 at 06:06
  • @coladict You do need to know the requirements of your relay server. If it is in provider's control, you may need to use a local relay. Your exim logs and bounce messages should tell you why the messages are bounced. Being spammy in one fashion or another may be the cause. – BillThor Apr 08 '15 at 08:18
  • It's been a long time, but I thought you should know. I got an account on the `mail.example.com` one to use as smarthost (it's managed by other people), but your suggestion still didn't work, because of a bug in the configuration scripts. Even though I select `no local mail`, it still enables local mail, leaving me with the same problem. Eventually through trial and error of the raw configuration I managed to fix it. – coladict Feb 10 '16 at 15:42
0

Give the host a proper fully qualified domain name. This is one of the many problems that occur when you name a host with the naked domain name.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940