Sending email with or without SMTP configuration?

sendmail is a mail transfer agent. You can use it to send emails to other MTAs, or it can also dispatch the emails locally. With PHPs mail function you don’t “connect” to it via SMTP though, but rather just run a command line utility (like /usr/sbin/sendmail). The sendmail program then probably (depends on config) connects directly to the target’s mail exchange server.
That’s why you don’t need to configure it. It’s all done on the OS level. It’s like in the good olden days where you could simply telnet to a server and write your email, no fancy encryption, authentication or anything…

The problem with sendmail is that, while the server admin could configure it so that it acts just as good as any other MTA software, it often isn’t done on stuff like shared hosting plans. Simply because it’s easier for them to run separate mailservers, which aren’t running on the same machine as the webserver. At that point those mailservers require authentication, which you couldn’t do with PHPs mail function anyway.

For this reason the webhost (where sendmail is running) is normally not the domain’s declared mailserver. It probably also isn’t even mentioned in the domain’s SPF record (and if it were, it would mean anyone on that machine could just send emails with your domain). All this contributes to the probability that the emails will be rejected by the target MTA.

By using the domains actual mail server, you make sure the emails you send with kirby get the same deliverability (except for the email’s contents, obviously) as every other normal email from that domain.

TL;DR: do what texnixe says and use an SMTP config (or any other authenticated mail transport config).

2 Likes