H
H
homm2010-09-16 10:36:09
linux
homm, 2010-09-16 10:36:09

Sending emails via exim4 to a domain equal to hostname if the mx record points to another host

There is a site on VDS, the domain example.ru points to it

$hostname
example.ru
$host example.ru
example.ru has address 92.243.84.xx
example.ru mail is handled by 10 mx1.example.ru.
$ host mx1.example.ru
mx1.example.ru has address 62.165.37.xx

There is a mailer exim4. When sending letters from the site (php mail()) to this domain, the letters do not reach.

$ php -r "var_dump(mail('[email protected]', 'text mail', 'test'));"
bool(true)
$ sudo grep [email protected] /var/log/exim4/mainlog
2010-09-16 13:23:42 1Ow8on-0005Sb-Cu ** [email protected]: Unrouteable address

When configuring exim4, among other things, it writes:

$ sudo dpkg-reconfigure exim4-config
Please enter a semicolon-separated list of recipient domains for which this machine
should consider itself the final destination. These domains are commonly called 'local'
domains'. The local hostname (example.ru) and 'localhost' are always added to the list
given here.

In general, the problem is just this, how to make sure that the local hostname no longer participates in the list of local domains for sending mail?

Background: Before that, there was a regular sendmail, there was the same problem. Googled a lot of similar solutions. Here is one of them: forum.lissyara.su/viewtopic.php?f=20&t=21720 I tried to bend sendmail, nothing happened, I spat, I installed exim4, like the person on the link, but the problem was not solved.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
C
charon, 2010-09-16
@homm

open the exim config and look at the local domains parameter (this, by the way, is what the error text says). Letters to domains from this list will be considered served by this server. All the rest are aliens and will be sent further.

A
Anton, 2015-03-18
@antonio1107

If /etc/exim4/update-exim4.conf.conf has the parameter dc_eximconfig_configtype='smarthost' or dc_eximconfig_configtype='satellite'
Then the /etc/exim4/exim4.conf.template file has the following setting:
smarthost:
debug_print = "R: smarthost for [email protected]$domain"
driver = manualroute
transport = remote_smtp_smarthost
route_list = * DCsmarthost byname
host_find_failed = ignore
same_domain_copy_routing = yes
no_more
This means that the server itself will accept mail for example.com. Also will not send for the domain on external. For example, if mail for a domain on yandex. For everything to come out, fix it to
domains = local_domains : !

V
Vitold S, 2010-09-16
@vit1251

If you work on examle.com, then just register it in local domains and mail will be delivered to your mailboxes.
Try to set up normal MX records.

H
homm, 2010-09-16
@homm

In /etc/exim4/exim4.conf.template I found the following line:

domainlist local_domains = MAIN_LOCAL_DOMAINS

Commented and added:
domainlist local_domains = localhost

After that, the logs say:
2010-09-16 14:24:39 1Ow9ll-00065A-Ce ** [email protected] R=dnslookup T=remote_smtp: SMTP error from remote mail server after MAIL FROM:<[email protected] ru> SIZE=1361: host mx1.example.ru [62.165.37.xx]: 550 <[email protected]>, Sender unknown
What would that mean? As I understand it, this is already a mailer on the mx1 server refusing to accept a letter on the grounds that the letter was sent from a user from the example.ru domain, and he himself drives the mail from this domain and thinks that they want to deceive him? Or is there something else here?

V
Vitold S, 2010-09-16
@vit1251

Put down these things:
domainlist local_domains = localhost: example.com: example.org: example.xxx
It should turn out that mail is not sent via SMTP transport, but is put into mailboxes.
PS If everything is really bad, I'm ready to help with EXIM for a little money. There are recommendations and ready-to-prodaction mail servers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question