If I'm correct there are 2 two (core) options for sending a mail from Moodle: phpmailer (moodle core) and a SMTP server.
Our client demands that Moodle sends a secure mail and usage of their or a third party SMTP server (to create SSL or TLS) is no option.
Can can I help my client?
P.S. phpmailer (moodle core) only prepares mails (MUA), it can not send directly to a MX (MTA). That is a myth, but not relevant here since you want to use a SMTP server of your own.
I misunderstood the SMTP working.
I will contact the client with this information
Kind Regards
With the client I have fixed the problem.
At the SMTP server you fill in the same information as the MX record of the DNS
Login is Plain.
Security is TLS
Possibly ... if 'client' will allow relay through another secure SMTP server.
Got Linux? Install postfix and configure for local only - sending only.
Then configure postfix to relay via SendGrid API ... Sendgrid does all the TLS/SPF/DKIM (that's almost all DNS records)/other for messages. SendGrid relays to customers SMTP.
You could then use PHPMailer as it will use local Postfix to relay to SendGrid and SendGrid onto customers/other mail servers.
OR set up Moodle to use SendGrid API directly.
I do Postfix relay to SendGrid as that gives me (the admin of the server) the abillity to use Alpine ... a text based MTA ... and via ssh logged on as root, to send individual messages to any Moodle user directly - by passing Moodle but having TLS/SPF/DKIM, etc.
And added benefit is one sees mail traffic in maillogs of server.
'SoS', Ken