Sending secure mail using phpmailer

Sending secure mail using phpmailer

by Frans Zwijnenberg -
Number of replies: 5

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?
 

Average of ratings: -
In reply to Frans Zwijnenberg

Re: Sending secure mail using phpmailer

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
You simply need the details of their or third party SMTP server and enter them in Site administration > Server > Email > Outgoing mail configuration. See https://docs.moodle.org/en/Messaging_settings#Email.

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.

P.P.S. What a secure e-mail is kind of philosophical (unless you are talking of end-to-end encryption). Another OT.
wink
In reply to Visvanath Ratnaweera

Re: Sending secure mail using phpmailer

by Frans Zwijnenberg -
Hi Visvanath
I misunderstood the SMTP working.
I will contact the client with this information
Kind Regards
In reply to Frans Zwijnenberg

Re: Sending secure mail using phpmailer

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
You are not the only one. A long time ago, I was asking myself, how Moodle, which is supposed to be a web application - accepting connections to HTTP or HTTPS, also open a SMTP port.

I think there was an old MoodleDoc page with such content. It is gone a long time. But still Moodle fills an empty SMTP hosts (smtphosts) field with 'localhost' - in the code, not in the user interface - which makes people to believe that Moodle has a way of sending e-mail, i.e. Moodle is also a MTA. The fix is simple. Make smtphosts field default to 'localhost'. But it has been like that for 18 years now, deeply rooted!
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Sending secure mail using phpmailer

by Frans Zwijnenberg -

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

In reply to Frans Zwijnenberg

Re: Sending secure mail using phpmailer

by Ken Task -
Picture of Particularly helpful Moodlers

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