The following example with fictional names describes my situation:
- External mail service mailservice.com
- DNS entry my.server.com points to the server publicly
- The server should send e-mails from [email protected]
I'm struggling to understand how to name the server (hostname) and what sendmail config to use. Currently, I have the config:
# /etc/hostname
some-random-hostname-without-tld
# /etc/hosts
127.0.0.1 localhost some-random-hostname-without-tld my.server.com
127.0.1.1 some-random-hostname-without-tld
/etc/mail/sendmail.mc
contains the minimal config for connecting to the account [email protected]
on mailservice.com
and defaults otherwise. DNS is setup correctly, i.e. MX, SPF etc. are in place to allow mailservice.com
to send and receive mails as yetanotherdomain.com
.
While sending e-mails works with this config, doing so takes over 60 seconds. /var/log/mail.info
reports that:
- Relay
root@localhost
reports immediately: "Message accepted for delivery"
- Over a minute later,
smtp.mailservice.com
reports: "stat=Sent (Ok: queued as ...)"
The delay indicates that there is something with my config. As stated above, I'm unsure about which domain to use where. Thus, I have the following questions:
- What do I need to assign to
/etc/hosts
as 127.0.0.1
resp. 127.0.1.1
?
- What should the contents of
/etc/hostname
be? Does it have to be something specific or can /etc/hosts
make up for non-FQDN as hostname?
- Do I need to configure a special host in
/etc/mail/sendmail.mc
or is use_cw_file
good enough in my case?