Won't find what you need in one place ...
Successful Emails or Messages? And just because systems say sent doesn't mean user reads. Case in point ... the 'nag' Emails from your moodle about new vesions of moodle available ... but you have routed to your trash or turned it off. End user could do same!
Moodle doeesn't really track true e-mail.
Messages it kinda knows about:
For a 24 hour period:
Query (below is from command line) and outputs to a 24hrmessages.txt file:
mysql -u root -p'password' -e "use moodledb;select userid,action,other,ip,realuserid,origin,ip from mdl_logstore_standard_log WHERE (timecreated > UNIX_TIMESTAMP(NOW() - INTERVAL 24 HOUR) and other like '%messageid%');"> 24hrmessages.txt;cat 24hrmessages.txt
Renders:
userid action other ip realuserid origin ip
9 sent a:2:{s:9:"messageid";i:18638;s:8:"courseid";s:1:"3";} NULL NULL cli NULL
12293 viewed a:1:{s:9:"messageid";i:18638;} NULL NULL cli NULL
1071 sent a:2:{s:9:"messageid";i:18639;s:8:"courseid";s:1:"3";} NULL NULL cli NULL
9 viewed a:1:{s:9:"messageid";i:18639;} NULL NULL cli NULL
1071 sent a:2:{s:9:"messageid";i:18640;s:8:"courseid";s:3:"106";} NULL NULL cli NULL
9 viewed a:1:{s:9:"messageid";i:18640;} NULL NULL cli NULL
9 sent a:2:{s:9:"messageid";i:18641;s:8:"courseid";s:3:"112";} NULL NULL cli NULL
12268 viewed a:1:{s:9:"messageid";i:18641;} NULL NULL cli NULL
1071 sent a:2:{s:9:"messageid";i:18642;s:8:"courseid";s:3:"112";} NULL NULL cli NULL
9 viewed a:1:{s:9:"messageid";i:18642;} NULL NULL cli NULL
1071 sent a:2:{s:9:"messageid";i:18643;s:8:"courseid";s:3:"118";} NULL NULL cli NULL
9 viewed a:1:{s:9:"messageid";i:18643;} NULL NULL cli NULL
1071 sent a:2:{s:9:"messageid";i:18644;s:8:"courseid";s:3:"211";} NULL NULL cli NULL
8691 viewed a:1:{s:9:"messageid";i:18644;} NULL NULL cli NULL
Translation ... user id 9 is an admin level user that communicates with users in site via Moodle messages. One can see course ID's above.
IP addresses are null because this shows activity of a cron job (cli) for distributing messages.
Obviously, one will need to look up other userid info to see who. And yet other tables for messages to see what. Leave that sluething to you!
*** If users preferences exclude using Email for such communications, no email is sent.
Real Email sent ... CentOS 6 Moodle/phpmailer with Senmail:
in /var/log/
[root@classroom log]# ls -l maillog*
-rw------- 1 root root 72546 Dec 11 07:21 maillog
-rw------- 1 root root 221483 Nov 17 03:51 maillog-20191117
-rw------- 1 root root 193469 Nov 24 03:45 maillog-20191124
-rw------- 1 root root 178961 Dec 1 03:41 maillog-20191201
-rw------- 1 root root 209007 Dec 8 03:38 maillog-20191208
Logs are rotated. maillog above is current active log.
clip of current maillog above:
Dec 11 07:21:30 classroom sendmail[22954]: xBBCLUgc022954: from=admins@email, size=1276, class=0, nrcpts=1, msgid=<5df0df4a2bf7e4.79463360@moodle.server.fqdn, relay=apache@localhost
Dec 11 07:21:30 classroom sendmail[22955]: xBBCLUuU022955: from=<admins@email>, size=1544, class=0, nrcpts=1, msgid=<5df0df4a2bf7e4.79463360@moodle.server.fqdn, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Dec 11 07:21:30 classroom sendmail[22954]: xBBCLUgc022954: to="X student" <sudents@hotmail.com.addreess>, ctladdr=admins@email (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31276, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (xBBCLUuU022955 Message accepted for delivery)
Obvously you'd not have access to sudents@hotmail.com.addreess nor the logs of hotmail server.
Ain't no easy button here! Dig in and have 'fun sluething'!
'SoS', Ken