Score:0

Sendmail not, er, sending mail

ml flag

Can someone help me out here please. I have a CentOS 8 install, and am trying this line:

echo "Subject: Hello" | sendmail -v [email protected]

This is /etc/hostname:

web.mydomain.com

This is /etc/resolv.conf

# Generated by NetworkManager
search mydomain.com
nameserver 1.1.1.1
nameserver 8.8.8.8

This is /etc/hosts:

### Hetzner Online GmbH installimage
# nameserver config
# IPv4
127.0.0.1 localhost.localdomain localhost
11.22.33.44 web.mydomain.com web
#
# IPv6
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
11:22:33:44::5 web.mydomain.com web

(IP addresses obviously falsified for this post)

I have DNS A- and AAAA-records for web.mydomain.com that point to the ip/ipv6 of the box.

I have corresponding reverse DNS entries set up at my host, Hetzner.

The output of that sendmail command is simply Mail Delivery Status Report will be mailed to <root>.

I'm logged in as root when I send it. Oddly I have a /var/spool/mail/mynamehere file but not a /var/spool/mail/root file?

As an aside, I have this at the bottom of /etc/aliases (and have run newaliases):

# Person who should get root's mail
root:           [email protected]

If you can't tell already, I have NO idea what I'm doing. All I want right now is to be able to send emails to myself from various cron jobs. Maybe I should be sending them to root and letting the alias forward them on, but I've tried that as well (simply root in place of [email protected]) and it didn't seem to work any better?

Mydomain.com's email is handled by gmail, and I have no problem sending or receiving from that address from the gmail web interface.

This is /etc/postfix/main.cf

compatibility_level = 2
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
inet_interfaces = localhost
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix/samples
readme_directory = /usr/share/doc/postfix/README_FILES
smtpd_tls_cert_file = /etc/pki/tls/certs/postfix.pem
smtpd_tls_key_file = /etc/pki/tls/private/postfix.key
smtpd_tls_security_level = may
smtp_tls_CApath = /etc/pki/tls/certs
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
smtp_tls_security_level = may
meta_directory = /etc/postfix
shlib_directory = /usr/lib64/postfix
in flag
You should start by [finding out what MTA you have installed](https://superuser.com/questions/340331/yum-searching-for-a-package-with-binary-name). Just because you have a binary called `sendmail` it doesn't mean you are using sendmail. All MTAs provide the same binaries (or symlinks with their names) for compatibility. When you figured out what you have (or IF you even have one) you should provide it's configuration.
Codemonkey avatar
ml flag
Thank you. Postfix. I've added main.cf (stripped of comments) to the question
in flag
Log entries related to your tests would also be helpful.
Codemonkey avatar
ml flag
OK, from finding the log and looking at it myself I can see the problem is my DMARC/SPF records on mydomain.com, since the server is trying to send the emails with a from address of [email protected], from an IP address not specified in my SPF record. I've added the IP of this box to my spf record, which maybe will be the fix. It has a 1day TTL though, so I'll have to play the waiting game.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.