Post Migration/Upgrade SMTP sending email

Post Migration/Upgrade SMTP sending email

by Karishma Tiwari -
Number of replies: 7

I have successfully upgraded from Moodle 3.5 (PHP 7.0, MYSQL 8.0) to Moodle 3.6 (PHP7.3, MYSQL 8.0) to Moodle 4.0 (PHP 8.0, MYSQL 8.0) on Ubuntu 22.


Currently the Outgoing mail settings in the Moodle is not set, yet the users are still receiving email alerts.






How is this possible?

How do I check or disable this?

Average of ratings: -
In reply to Karishma Tiwari

Re: Post Migration/Upgrade SMTP sending email

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Because there must be a 'Sendmail' service running on your server. Moodle defaults to using that if the smtp settings are empty. It's quite rare for that to work these days. However, if you're on a hosted site it's quite possible that is configured and working.
Average of ratings:Useful (1)
In reply to Howard Miller

Re: Post Migration/Upgrade SMTP sending email

by Karishma Tiwari -
Ive checked with my server host, there is no smtp setup or sendmail.

I also tried this:
Last login: Wed Sep 21 14:49:06 2022 from 202.186.59.46
root:~# ps -e |grep sendmail
root:~#
In reply to Karishma Tiwari

Re: Post Migration/Upgrade SMTP sending email

by Ken Task -
Picture of Particularly helpful Moodlers

sendmail doesn't have to be a running process to be called by php.

php -i |grep sendmail

sendmail is actually 'split' ... one for localhost (submit) and one for sending/receiving (true sendmail) to other systems.   Is your root user getting any system emails/notifications?  That would be useful me thinks!  Might install alpine to see.

Depending upon how hosted, it is possible for an internal network to have an internal mail server for all port 25 traffic - no smtp setup required.

Look at the full header of the message you did get, reading from subject line upwards to the top of the header.   Think you will see phpmailer which is built into moodle.

However, can turn off any email using a line in config.php file.

 $CFG->noemailever = true;

'SoS', Ken


In reply to Howard Miller

Re: Post Migration/Upgrade SMTP sending email

by Karishma Tiwari -

I really need to disable this now as it is a test machine and it is spamming the real students.

In reply to Karishma Tiwari

Re: Post Migration/Upgrade SMTP sending email

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
The term "Sendmail" is generic to mean any SMTP server like the "grand father" Sendmail. Do this to get the name of the service you are running:

$ telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 foobar.example.com ESMTP Postfix (Ubuntu)
quit
Connection closed by foreign host.
In the above example it is Postfix. Since you are on Ubuntu you can do something similar to:

$ sudo apt-get remove postfix
May be you want to stop this test Moodle sending mail at all. There is a parameter for config.php. Check config-dist.php.
In reply to Karishma Tiwari

Re: Post Migration/Upgrade SMTP sending email

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
You could just put some settings on the outgoing mail setup. Settings that you know won't work and that will stop the mail going out while you figure out what was actually sending it.
In reply to Karishma Tiwari

Re: Post Migration/Upgrade SMTP sending email

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Add this line in your config.php file...

$CFG->nomailever = true;